Skip to content

Commit

Permalink
Added document strings to more methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
eloyz committed Oct 29, 2012
1 parent ed59f63 commit 7869394
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions apps/time_spent/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ def total_amount(cls, creator):

@classmethod
def total_time(cls, creator):
"""
Returns the number of years it would take
to purchase on wish list items for creator.
"""
from math import ceil, floor

net = NetIncome(creator=creator)
Expand All @@ -136,9 +140,18 @@ def total_time(cls, creator):
}

def amount_with_tax(self):
"""
Returns the amount for the wish list item
once tax is included.
"""
return self.amount * 1.0825

def time(self):
"""
Returns the amount of time it would take to purchase
this wish list item. Returns dictionary with keys
(e.g. years, months, days)
"""
from math import ceil, floor

years = self.years()
Expand All @@ -154,13 +167,25 @@ def time(self):
}

def years(self):
"""
Returns the number of years it would take to pay
for this wish list item.
"""
from math import floor
return floor(self.amount_with_tax() / self.net_income.yearly())

def months(self):
"""
Returns the number of months it would take to pay
for this wish list item.
"""
from math import floor
return floor(self.amount_with_tax() / self.net_income.monthly())

def days(self):
"""
Returns the number of days it would take to pay
for this wish list item.
"""
from math import floor
return floor(self.amount_with_tax() / self.net_income.daily())

0 comments on commit 7869394

Please sign in to comment.