Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Explicitly return zero if the unit cost is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
justinvdm committed Feb 24, 2015
1 parent dd81d99 commit 3e27932
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion go/billing/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ def get_count(transaction):
def get_session_length_count(transaction):
length_cost = get_session_length_cost(transaction)
unit_cost = get_session_length_unit_cost(transaction)
return length_cost / (unit_cost if unit_cost != 0 else 1)

if unit_cost == 0:
return Decimal(0)
else:
return length_cost / unit_cost


def get_message_unit_cost(transaction):
Expand Down

0 comments on commit 3e27932

Please sign in to comment.