wtg / Shuttle-Tracker-SwiftUI

Rensselaer campus shuttle tracker
https://shuttletracker.app
Mozilla Public License 2.0
9 stars 2 forks source link

Dynamic Schedule feature #61

Closed EdgValle closed 2 years ago

EdgValle commented 2 years ago

Parse through the schedules dictionary, and get the schedule based on the day/time period of the schedule. Currently only one schedule in the JSON given through the endpoint and a template schedule. More can/will be added as changes/new terms occur.

EdgValle commented 2 years ago

More info on the JSON file:

The JSON file contains an array of schedules. Inside each schedule in the array, there's name, start, end, and content. name contains the term name the schedule applies for (Spring 2022, etc.). start and end have date/time in ISO format that correspond to the timeframe the schedule is valid for. content contains 7 days of the week starting with Monday and ending with Sunday. Inside each of those days is another 'start' and 'end' that contain strings of the time period for the schedule. (start: "08:00", end: "23:45")

Currently, the Spring 2022 schedule is inside the Schedules JSON and a placeholder schedule is right after it for future reference if it needs to be changed. I've pasted the JSON file here for reference in case it seemed a bit confusing. Let me know if any issues come up!

Code: { "schedules" : [ { "name": "Spring 2022", "start": "2022-01-23T07:00:00.000Z", "end": "2022-05-6T23:45:00.000Z", "content": { "Monday": {"start": "7:00", "end": "23:45"}, "Tuesday": {"start": "07:00", "end": "23:45"}, "Wednesday": {"start": "07:00", "end": "23:45"}, "Thursday": {"start": "07:00", "end": "23:45"}, "Friday": {"start": "07:00", "end": "23:45"}, "Saturday": {"start": "09:00", "end": "23:45"}, "Sunday": {"start": "09:00", "end": "8:00"} } }, { "name": "Term Year", "start": "2069-04-20T07:00:00.000Z", "end": "2069-04-20T23:45:00.000Z", "content": { "Monday": {"start": "01:00", "end": "23:00"}, "Tuesday": {"start": "01:00", "end": "23:00"}, "Wednesday": {"start": "01:00", "end": "23:00"}, "Thursday": {"start": "01:00", "end": "23:00"}, "Friday": {"start": "01:00", "end": "23:00"}, "Saturday": {"start": "01:00", "end": "23:00"}, "Sunday": {"start": "01:00", "end": "23:00"} } } ] }

Gerzer commented 2 years ago

@emmaleengo I see that you closed this issue. Do you have a pull request open? I suggest that you reopen it until a relevant pull request is merged.