문제

On my website, users can rate each other's nodes via a Fivestar field called Stars in a comment. I'd now like to calculate the overall average score of a user. That means, I'd like to display the user's average score for all his/her nodes.

For example. Let's say a user created 2 nodes: Node 1 and Node 2. Some people rated his content:

  • Scores of Node 1: 4/5, 5/5, 3/5
  • Scores of Node 2: 4/5, 4/5

The overall average would then be (4+5+3+4+4)/5=4.

Preferably, this result should also be displayed as stars.

How can I do that?


Edit: Working with the Computed Field module seems to be a general idea to solve this matter. It looks fine to me and I think it's best to store the users' average score in a user field, in order to make it easily accessable. (Working with a view is also fine.) I'm planning to display the average score on their profile page, but perhaps I'm going to use it elsewhere on the website in the future too.

Can you please help me with (a scetch) of the code I'm supposed to use?

도움이 되었습니까?

해결책

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top