Calculate _Overdue_ status the same way as old portal

This commit is contained in:
Tanner Collin 2020-02-10 04:47:24 +00:00
parent dd68adfe68
commit 82b9955a56
2 changed files with 13 additions and 3 deletions

View File

@ -143,9 +143,10 @@ class TestCalcStatus(TestCase):
self.assertEqual(former, False) self.assertEqual(former, False)
def test_calc_member_status_1_month(self): def test_calc_member_status_1_month(self):
expire_date = utils.today_alberta_tz() + relativedelta.relativedelta(months=1) today = datetime.date(2019, 2, 10)
expire_date = datetime.date(2019, 3, 10)
status, former = utils.calc_member_status(expire_date) status, former = utils.calc_member_status(expire_date, today)
self.assertEqual(status, 'Current') self.assertEqual(status, 'Current')
self.assertEqual(former, False) self.assertEqual(former, False)
@ -182,6 +183,15 @@ class TestCalcStatus(TestCase):
self.assertEqual(status, 'Due') self.assertEqual(status, 'Due')
self.assertEqual(former, False) self.assertEqual(former, False)
def test_calc_member_status_1_month_ago(self):
today = datetime.date(2019, 4, 10)
expire_date = datetime.date(2019, 3, 10)
status, former = utils.calc_member_status(expire_date, today)
self.assertEqual(status, 'Overdue')
self.assertEqual(former, False)
def test_calc_member_status_85_days_ago(self): def test_calc_member_status_85_days_ago(self):
expire_date = utils.today_alberta_tz() - datetime.timedelta(days=85) expire_date = utils.today_alberta_tz() - datetime.timedelta(days=85)

View File

@ -56,7 +56,7 @@ def calc_member_status(expire_date, fake_date=None):
return 'Prepaid', False return 'Prepaid', False
elif difference <= -3: elif difference <= -3:
return 'Overdue', True return 'Overdue', True
elif difference <= -1: elif today - timedelta(days=29) >= expire_date:
return 'Overdue', False return 'Overdue', False
elif today < expire_date: elif today < expire_date:
return 'Current', False return 'Current', False