def test_business_days(self): from kardboard.util import business_days_between wednesday = datetime.datetime(year=2011, month=6, day=1) next_wednesday = datetime.datetime(year=2011, month=6, day=8) result = business_days_between(wednesday, next_wednesday) self.assertEqual(result, 5) aday = datetime.datetime(year=2011, month=6, day=1) manydayslater = datetime.datetime(year=2012, month=6, day=1) result = business_days_between(aday, manydayslater) self.assertEqual(result, 262)
def lead_time(self): """ Caclucation of the number of days between the backlogging of a card and its completion. Returns None if the card hasn't completed yet. """ if self.done_date: return business_days_between(self.backlog_date, self.done_date)
def cycle_time(self): """ Caclucation of the number of days between the start of a card and its completion. Returns None if the card hasn't completed yet. """ if self.start_date and self.done_date: return business_days_between(self.start_date, self.done_date)
def current_lead_time(self, today=None): """ Caclucation of the number of days between the backlogging of a card and a comparison point (defaults to today). """ if not self.backlog_date: return None if not today: today = now() return business_days_between(self.backlog_date, today)
def current_cycle_time(self, today=None): """ Caclucation of the number of days between the start of a card and a comparison point (defaults to today). Returns None if the card hasn't started yet. """ if not self.start_date: return None if not today: today = datetime.datetime.now() return business_days_between(self.start_date, today)
def current_cycle_time(self, today=None): """ Caclucation of the number of days between the start of a card and a comparison point (defaults to today). Returns None if the card hasn't started yet. """ if not self.start_date: return None if not today: today = now() return business_days_between(self.start_date, today)