Average value of Multiaxis FiveStar value configuration Drupal 7.7, FiveStar 2.x-dev, References module, Unique field.


I have node value of Story tale
Every user can write an Review and rate each story tale with multiaxis fivestar like: Idea, Grammar, etc. configures as rating references.
Every user can create only one review per each story tale (unique field module).
Rating is available when User create a Review node (so not ajax).


I can attach average rate of each one from multiaxis like Average Grammar, Average Idea etc for story tale by views.

What I can't do is: how to compute average of all multiaxis values it menas create one number computed from rating of Grammar + Ideas.

I tried create a Fivestar field for overall (average value).
Then I created Computed field which compute overall value of review.

$overall = ($entity-&gt;field_style[$entity-&gt;language][0]['rating'] + $entity-&gt;field_rate[$entity-&gt;language][0]['rating'])/2;
$entity_field[0]['value'] = $overall/10;
$entity-&gt;field_overall[$entity-&gt;language][0]['rating'] = $overall;


Well Problem is that In field_overall is stored requested value, but VotingApi don't register this change created by computed field and it count 0 as stored value.

So.
1. Problem is that fivestar store this value before computed field compute overall rating
2. Or problem is, that fivestar is reading value not from $entity-&gt;field_overall but from other value.
The easiest thing to do would be to set the value yourself with either hook_entity_insert/update or in a custom submit handler to the form.

The values are stored in the fields tables and not voting API when you use the five star with fields.