ushahidi/Ushahidi_Web — pull request #1038 by solarissmoke (2013-03-19 04:47:17+00:00)
Title: Report total rating for an incident rather than one rating arbitrarily.

Hi there,

When fetching the incident rating for reports, Ushahidi currently does this:

```php
$rating = ORM::factory('rating')
->join('incident','incident.id','rating.incident_id','INNER')
->where('rating.incident_id',$incident->id)
->find();
```

... which is just arbitrarily fetching one rating from all the possible ratings for that incident. This means that the report will only ever return a rating of -1, 0 or 1 (regardless of how many people have rated it!), and that too inconsistently depending on which row the ORM returns.

I think the sum of all ratings for any incident is what should be used here? There is already a helper function to fetch this.