Skip to content

Instantly share code, notes, and snippets.

@kevinvangelder
Created August 26, 2013 17:31
Show Gist options
  • Save kevinvangelder/6344156 to your computer and use it in GitHub Desktop.
Save kevinvangelder/6344156 to your computer and use it in GitHub Desktop.
Country Restoration Satisfaction Old
$total = db_query_row("SELECT SUM(overall_customer_service) FROM surveys WHERE approved = 1");
$survey_count = db_count("surveys", "WHERE approved = 1");
$added_up = $total["SUM(overall_customer_service)"];
$average = ((103 * 9.733) + $added_up) / (103 + $survey_count); // this is taking into account the previous (103) unadded surveys
$rating = number_format((($average * 1000) / 100), 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment