Skip to content

Commit

Permalink
casting total as float in the presenter's calculate percent method
Browse files Browse the repository at this point in the history
  • Loading branch information
dsjen committed Oct 16, 2014
1 parent c9df233 commit 65393ad
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions analytics_dashboard/courses/presenters.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,11 +314,10 @@ def _build_binned_ages(self, api_response):
return binned_ages

def _calculate_total_enrollment(self, api_response):
# get the sum as a float so we can divide by it to get a percent
return float(sum([datum['count'] for datum in api_response]))
return sum([datum['count'] for datum in api_response])

def _calculate_percent(self, count, total):
return count / total if total > 0 else 0.0
return count / float(total) if total > 0 else 0.0

def _calculate_education_percent(self, api_response, levels, total):
""" Aggregates levels of education and returns the percent of the total. """
Expand Down

0 comments on commit 65393ad

Please sign in to comment.