From 903b77385e4a7fd7317037e864b9fb17c8af68cc Mon Sep 17 00:00:00 2001 From: David Schlachter Date: Tue, 19 May 2020 23:35:07 -0400 Subject: [PATCH] Fix updatestats where section only has DGD or TUT activities --- .../ca/uottawa/schedule/Schedule.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/schedule-generator/ca/uottawa/schedule/Schedule.java b/schedule-generator/ca/uottawa/schedule/Schedule.java index ecc9389..f554c07 100644 --- a/schedule-generator/ca/uottawa/schedule/Schedule.java +++ b/schedule-generator/ca/uottawa/schedule/Schedule.java @@ -512,10 +512,15 @@ public void updateStats() { avgStartingTime = new Date(totalStartTime / (7 - numOfDaysOff)); avgEndingTime = new Date(totalEndTime / (7 - numOfDaysOff)); avgLengthOfDay = new Date(totalLengthOfDay / (7 - numOfDaysOff)); - - ignoreExtrasAvgStartingTime = new Date(ieTotalStartTime / (7 - ignoreExtrasNumOfDaysOff)); - ignoreExtrasAvgEndingTime = new Date(ieTotalEndTime / (7 - ignoreExtrasNumOfDaysOff)); - ignoreExtrasAvgLengthOfDay = new Date(ieTotalLengthOfDay / (7 - ignoreExtrasNumOfDaysOff)); + if (ieTotalStartTime == 0) { + ignoreExtrasAvgStartingTime = avgStartingTime; + ignoreExtrasAvgEndingTime = avgEndingTime; + ignoreExtrasAvgLengthOfDay = avgLengthOfDay; + } else { + ignoreExtrasAvgStartingTime = new Date(ieTotalStartTime / (7 - ignoreExtrasNumOfDaysOff)); + ignoreExtrasAvgEndingTime = new Date(ieTotalEndTime / (7 - ignoreExtrasNumOfDaysOff)); + ignoreExtrasAvgLengthOfDay = new Date(ieTotalLengthOfDay / (7 - ignoreExtrasNumOfDaysOff)); + } } }