Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Mazhar Alam
Adding rating functionality to message boards -threads
3 gennaio 2013 4.04
Risposta

Mazhar Alam

Punteggio: Regular Member

Messaggi: 201

Data di Iscrizione: 25 novembre 2011

Messaggi recenti

Hi all,
Im trying to add rating feature using-

<liferay-ui:ratings
className="<%= MBMessage.class.getName() %>"
classPK="<%= message.getMessageId() %>"
type="stars"
/>

But when i rate and suppose i gave 4 rating(stars) to any thread post..An error comes--

com.liferay.portlet.ratings.EntryScoreException
at com.liferay.portlet.ratings.service.impl.RatingsEntryLocalServiceImpl.validate(RatingsEntryLocalServiceImpl.java:266)
at com.liferay.portlet.ratings.service.impl.RatingsEntryLocalServiceImpl.updateEntry(RatingsEntryLocalServiceImpl.java:151)


Any ideas how to resolve this...
Hitoshi Ozawa
RE: Adding rating functionality to message boards -threads
6 gennaio 2013 14.59
Risposta

Hitoshi Ozawa

Punteggio: Liferay Legend

Messaggi: 7949

Data di Iscrizione: 23 marzo 2010

Messaggi recenti

If you look at the ratingsentry and ratingstats table (or related definition in service.xml), it seems you wont be able to use liferay's rating in message board posts.
Mazhar Alam
RE: Adding rating functionality to message boards -threads
12 aprile 2013 3.47
Risposta

Mazhar Alam

Punteggio: Regular Member

Messaggi: 201

Data di Iscrizione: 25 novembre 2011

Messaggi recenti

I checked my portal source, which wasn't updated one..so i was not able to resolve..now i ' ve resolved the issue..Thanks anyway for you help...:-)
Vitaliy Koshelenko
RE: Adding rating functionality to message boards -threads
26 marzo 2015 10.37
Risposta

Vitaliy Koshelenko

Punteggio: Expert

Messaggi: 284

Data di Iscrizione: 25 marzo 2011

Messaggi recenti

Add the following properties:

1ratings.max.score[com.liferay.portlet.messageboards.model.MBDiscussion]=5
2ratings.min.score[com.liferay.portlet.messageboards.model.MBDiscussion]=1
3
4ratings.max.score[com.liferay.portlet.messageboards.model.MBMessage]=5
5ratings.min.score[com.liferay.portlet.messageboards.model.MBMessage]=1
Ellisa Khoja
RE: Adding rating functionality to message boards -threads
12 maggio 2015 0.41
Risposta

Ellisa Khoja

Punteggio: New Member

Messaggi: 2

Data di Iscrizione: 6 ottobre 2014

Messaggi recenti

Mazhar Alam:
Hi all,
Im trying to add rating feature using-

<liferay-ui:ratings
className="<%= MBMessage.class.getName() %>"
classPK="<%= message.getMessageId() %>"
type="stars"
/>

But when i rate and suppose i gave 4 rating(stars) to any thread post..An error comes--

com.liferay.portlet.ratings.EntryScoreException
at com.liferay.portlet.ratings.service.impl.RatingsEntryLocalServiceImpl.validate(RatingsEntryLocalServiceImpl.java:266)
at com.liferay.portlet.ratings.service.impl.RatingsEntryLocalServiceImpl.updateEntry(RatingsEntryLocalServiceImpl.java:151)


Any ideas how to resolve this...


I am getting same error. can you please provide solution?
Ellisa Khoja
RE: Adding rating functionality to message boards -threads
12 maggio 2015 0.42
Risposta

Ellisa Khoja

Punteggio: New Member

Messaggi: 2

Data di Iscrizione: 6 ottobre 2014

Messaggi recenti

I am getting same error. can you please provide solution?
Jitendra Rajput
RE: Adding rating functionality to message boards -threads
12 maggio 2015 11.33
Risposta

Jitendra Rajput

Punteggio: Liferay Master

Messaggi: 858

Data di Iscrizione: 7 gennaio 2011

Messaggi recenti

If you check validate() method implementation in that it is checking if current score is > max score or current score < min score it will throw EntryScoreException.

 1protected void validate(String className, double score)
 2        throws PortalException {
 3
 4        Filter filter = new Filter(className);
 5
 6        double maxScore = GetterUtil.getInteger(
 7            PropsUtil.get(PropsKeys.RATINGS_MAX_SCORE, filter),
 8            PropsValues.RATINGS_DEFAULT_NUMBER_OF_STARS);
 9        double minScore = GetterUtil.getInteger(
10            PropsUtil.get(PropsKeys.RATINGS_MIN_SCORE, filter));
11
12        if ((score < minScore) || (score > maxScore)) {
13            throw new EntryScoreException();
14        }
15    }


To correct this you need to add properties suggested by Vitally in portal-ext file.

 1  #
 2    # Set the number of max score and min score that will be used by the ratings
 3    # tag library for each model.
 4    #
 5    ratings.max.score[com.liferay.portlet.messageboards.model.MBDiscussion]=1
 6    ratings.min.score[com.liferay.portlet.messageboards.model.MBDiscussion]=-1
 7
 8    ratings.max.score[com.liferay.portlet.messageboards.model.MBMessage]=1
 9    ratings.min.score[com.liferay.portlet.messageboards.model.MBMessage]=-1
Mazhar Alam
RE: Adding rating functionality to message boards -threads
3 giugno 2015 22.10
Risposta

Mazhar Alam

Punteggio: Regular Member

Messaggi: 201

Data di Iscrizione: 25 novembre 2011

Messaggi recenti

Hi Ellisa,

Please follow what Jitendra has suggested..I had modified the same properties.

Thanks