From 10317c5b4eaf87931216c3e1674a039ac412479f Mon Sep 17 00:00:00 2001 From: Mordecai Veldt Date: Sun, 24 Apr 2016 21:14:17 -0400 Subject: [PATCH] fix a bug that overstated time left for hobbyists after midnight Added one if statement to avoid the addition of a day during the schedule description if the time is after midnight. --- qschedule.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qschedule.py b/qschedule.py index 536379a..4d60f4a 100644 --- a/qschedule.py +++ b/qschedule.py @@ -58,7 +58,10 @@ def timeUntilWeeknight(self, t): return weeknightStart - t def weeknightTimeRemaining(self, t): - weeknightEnd = t + relativedelta(hour=6, minute=0, second=0, microseconds=0, days=+1) + if t.hour >=18: + weeknightEnd = t + relativedelta(hour=6, minute=0, second=0, microseconds=0, days=+1) + else: + weeknightEnd = t + relativedelta(hour=6, minute=0, second=0, microseconds=0, days=0) return weeknightEnd - t def isWeekend(self, t):