Hi, I'm trying to print average from comment ratings in node-tpl.php, but dunno how, could someone help?
print fivestar_widget_form($node);
prints average node rating, but not average from comments rating
Thanx
Hi, I'm trying to print average from comment ratings in node-tpl.php, but dunno how, could someone help?
print fivestar_widget_form($node);
prints average node rating, but not average from comments rating
Thanx
Comments
Comment #1
sedmi commentedI would also like to be able to print average from comment rating.
Comment #2
czeky commentedAnyone? There has to be a way how to do this..
Comment #3
sedmi commentedIt is possible by using nodecomment module. great tutorial: http://drupal.org/node/234681
Comment #4
virtualdrupal commentedThat link above seems like overkill for this task.. isn't there a shortcut to tally up the average of all the comment ratings by the nodeid, and output the results with something like this?
Comment #5
czeky commentedwould be great to achieve this, can't believe that this is not possible
Comment #6
quicksketchYou might be misunderstanding the way Fivestar works. The "average node rating" and the "average from comments" is essentially the same. When you allow a user to rate from a comment, it's the same as if they had clicked on the star rating widget within the node. Generally you probably won't want to have both the direct-rating and the comment-rating enabled on the same node, since they both do the same thing.
Comment #7
czeky commentedHi, thanx for a reply, I thought so, but when I comment node (in my case profile node) say 1 star from 10 and second vote 3 stars from 10, I'd expect average rating to be 2 from 10, but this is not what it shows, I'd like to show this value, now it shows something different, dunno what (in my case 5 from 10, doesn't matter what rating was added in comment), I know, it should work, just searching for the right php
is not displaying what I need - the average from comment ratings
EDIT: average prints only the last value of the vote, so when I vote 2, then 4, then 6, I would expect 4, but 6 is displayed
Comment #8
quicksketchYes, this is correct because Fivestar (or VotingAPI more accurately) only allows one rating per-user. So if you leave 100 comments all as the same user, only the last rating actually affects the average. If you rate as a different user each time, then the average is taken from each user's last rating.
Comment #9
quicksketchA related feature request is to not allow users to post (or at least submit a rating through) multiple comments. See #211517: Prevent a user from rating through multiple comments.
Comment #10
czeky commentedHi, thanx for explanation, it's clear.. anyway what I'm trying to achieve is in this example
3 voting on node ‚nid‘ = 10, first vote ‚cid‘ = 5 and ‚value‘ = 10, second vote ‚cid‘ = 8 and ‚value‘ = 3, third vote ‚cid‘ = 20 and ‚value‘ = 5
value calculation 10+3+5 = 18 / 3 votes = 6 … average rating is 6 from10 (60%)
Comment #11
quicksketchczeky: Yes this is the way Fivestar works, as long as each comment is from a different user.
Comment #12
ericduran commentedI'm going to close this issue because of previous comments. Feel free to reopen if needed.