summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordusoleil <howcansocksbereal@gmail.com>2022-08-27 01:23:22 -0400
committerdusoleil <howcansocksbereal@gmail.com>2022-08-27 01:23:22 -0400
commit32e8b2e99c99751389f4d1b2d1871f75562fbb22 (patch)
tree11e5d680d31758ad73a5b582c07c29bf8cdf048e
parentd406db13f0e14766e61c0b12e95938cf6ceb16d8 (diff)
downloadPlanner-32e8b2e99c99751389f4d1b2d1871f75562fbb22.tar.gz
Planner-32e8b2e99c99751389f4d1b2d1871f75562fbb22.zip
Shift earlier records to the back if they would be before midnight after bias correction
-rw-r--r--data_model/TimeSlot.gd7
1 files changed, 7 insertions, 0 deletions
diff --git a/data_model/TimeSlot.gd b/data_model/TimeSlot.gd
index ac1a008..6f92c81 100644
--- a/data_model/TimeSlot.gd
+++ b/data_model/TimeSlot.gd
@@ -36,4 +36,11 @@ static func get_by_schedule_name(schedule_name):
var timeslots = []
for record in records:
timeslots.push_back(TimeSlot_data.new(record))
+ #shift earlier records to the back if they would be <12:00AM after bias correction
+ var bias = Time.get_time_zone_from_system().bias * 60
+ var tsi = 0
+ var tslen = timeslots.size()
+ while tsi < tslen && (timeslots[0].start_time + bias < 0):
+ tsi += 1
+ timeslots.push_back(timeslots.pop_front())
return timeslots