How to calculate the rate of one field based on another rate

i m using a rating system by star.

performance:
terms:
team:
overall:

for overall, i need to calculate it automatically, based on another
three rating.

here is my code.
view:—

Performance <%= render :partial => "rating" , :locals => {:rate => 'performance'}%> <%= hidden_field_tag(:rating_performance) %>
Team <%= render :partial => "rating" , :locals => {:rate =>'Team'} %> <%= hidden_field_tag(:rating_Team) %>
Strategy <%= render :partial => "rating" , :locals => {:rate =>'strategy'} %> <%= hidden_field_tag(:rating_strategy) %>
Terms <%= render :partial => "rating" ,:locals => {:rate => 'terms'}%> <%= hidden_field_tag(:rating_terms) %>
Overall <%= render :partial => "rating" ,:locals => {:rate => 'overall'}%> <%= hidden_field_tag(:rating_overall) %>

partial_rating-----

but it is not working fine. The star of overall is not highlight
automatically.

could u plz help me as soon as possible as soon as possible.

Thanks,