mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RatingService GET node ratings statistics via REST.
Added node rating stats to the ratings.get webscript (for each scheme): average (mean) of all ratings for this node. total (sum) of all ratings for this node. count of all ratings for this node. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21108 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -328,8 +328,15 @@ public class RatingServiceImpl implements RatingService
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ratingCount == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (float)ratingTotal / (float)ratingCount;
|
||||
}
|
||||
}
|
||||
|
||||
public int getRatingsCount(NodeRef targetNode, String ratingSchemeName)
|
||||
{
|
||||
|
@@ -95,6 +95,13 @@ public interface RatingService
|
||||
|
||||
int getTotalRating(NodeRef targetNode, String ratingSchemeName);
|
||||
|
||||
/**
|
||||
* This method returns the average (mean) rating in the specified scheme for the
|
||||
* specified nodeRef. If there have been no ratings applied, -1 is returned.
|
||||
* @param targetNode the node for which an average is sought.
|
||||
* @param ratingSchemeName the rating scheme name in which the average is defined.
|
||||
* @return the average (mean) value if there is one, else -1.
|
||||
*/
|
||||
float getAverageRating(NodeRef targetNode, String ratingSchemeName);
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user