I have tuples that represent bus stops including the departure times of that stop. The departure times are listed as [710, 810, 910] that represents 7:10, 8:10, 9:10. The reason for that is that I cannot use a timestamp because the time is the same for each weekday. I know that I can access these values e. g. via a MAP operator by using e. g. monday.
Code: Select all
'stop': 'Stopname', 'serviceLine' : '901', 'headingDirection': 'Station', 'monday': [710, 810, 910], 'tuesday': [710, 810, 910], 'wednesday': [710, 810, 910], 'thursday': [710, 810, 910], 'friday': [710, 810, 910], 'saturday': , 'sunday': , 'travelTime' : 5, 'waitingTime': 0 (must be calculated), 'nextDeparture': (must be calculated), 'arrivalTime': (must be calculated), 'desiredDepartureTime': 700, 'desiredDepartureWeekday': 'monday', 'isPossible': true
Does anybody have an idea or hints? The most difficult thing is to "loop" through the departure times and get the closest value. The rest should be possible by "basic calculations" in a map/statemap operator.