Foros de discusión
Adding rating functionality to message boards -threads
Mazhar Alam, modificado hace 11 años.
Adding rating functionality to message boards -threads
Regular Member Mensajes: 191 Fecha de incorporación: 25/11/11 Mensajes recientes
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...
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, modificado hace 11 años.
RE: Adding rating functionality to message boards -threads
Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
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, modificado hace 11 años.
RE: Adding rating functionality to message boards -threads
Regular Member Mensajes: 191 Fecha de incorporación: 25/11/11 Mensajes recientes
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, modificado hace 9 años.
RE: Adding rating functionality to message boards -threads
Expert Mensajes: 319 Fecha de incorporación: 25/03/11 Mensajes recientes
Add the following properties:
ratings.max.score[com.liferay.portlet.messageboards.model.MBDiscussion]=5
ratings.min.score[com.liferay.portlet.messageboards.model.MBDiscussion]=1
ratings.max.score[com.liferay.portlet.messageboards.model.MBMessage]=5
ratings.min.score[com.liferay.portlet.messageboards.model.MBMessage]=1
Ellisa Khoja, modificado hace 8 años.
RE: Adding rating functionality to message boards -threads
New Member Mensajes: 2 Fecha de incorporación: 6/10/14 Mensajes recientesMazhar 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, modificado hace 8 años.
RE: Adding rating functionality to message boards -threads
New Member Mensajes: 2 Fecha de incorporación: 6/10/14 Mensajes recientes
I am getting same error. can you please provide solution?
Mazhar Alam, modificado hace 8 años.
RE: Adding rating functionality to message boards -threads
Regular Member Mensajes: 191 Fecha de incorporación: 25/11/11 Mensajes recientes
Hi Ellisa,
Please follow what Jitendra has suggested..I had modified the same properties.
Thanks
Please follow what Jitendra has suggested..I had modified the same properties.
Thanks
Jitendra Rajput, modificado hace 8 años.
RE: Adding rating functionality to message boards -threads
Liferay Master Mensajes: 875 Fecha de incorporación: 7/01/11 Mensajes recientes
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.
To correct this you need to add properties suggested by Vitally in portal-ext file.
protected void validate(String className, double score)
throws PortalException {
Filter filter = new Filter(className);
double maxScore = GetterUtil.getInteger(
PropsUtil.get(PropsKeys.RATINGS_MAX_SCORE, filter),
PropsValues.RATINGS_DEFAULT_NUMBER_OF_STARS);
double minScore = GetterUtil.getInteger(
PropsUtil.get(PropsKeys.RATINGS_MIN_SCORE, filter));
if ((score < minScore) || (score > maxScore)) {
throw new EntryScoreException();
}
}
To correct this you need to add properties suggested by Vitally in portal-ext file.
#
# Set the number of max score and min score that will be used by the ratings
# tag library for each model.
#
ratings.max.score[com.liferay.portlet.messageboards.model.MBDiscussion]=1
ratings.min.score[com.liferay.portlet.messageboards.model.MBDiscussion]=-1
ratings.max.score[com.liferay.portlet.messageboards.model.MBMessage]=1
ratings.min.score[com.liferay.portlet.messageboards.model.MBMessage]=-1