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

**URL:** <https://www.ruby-forum.com/t/how-to-calculate-the-rate-of-one-field-based-on-another-rate/168289>\
**Category:** Rails\
**Created:** [May 19, 2009, 8:14am UTC](https://www.ruby-forum.com/t/how-to-calculate-the-rate-of-one-field-based-on-another-rate/168289 "2009-05-19T08:14:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nishi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ad7895/32.png) [@nishi](https://www.ruby-forum.com/u/nishi)\
**Post date:** [May 19, 2009, 8:14am UTC](https://www.ruby-forum.com/t/how-to-calculate-the-rate-of-one-field-based-on-another-rate/168289/1 "2009-05-19T08:14:09Z")

</div>

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-----

- 1
- 2
- 3
- 4
- 5

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,
