Report total rating for an incident rather than one rating arbitrarily.
Improve code to get total incident rating - use SQL SUM()

Also adding $db to controllers
Improve reports/ID/rating SQL to use proper where() array-key filter
Merge branch 'pull-request-1038' into develop

Closes #1038