CRLSCSClub / CRLSTime

A clock for showing the CRLS schedule during the school day
6 stars 10 forks source link

one schedule for all lunches (issue #4) #44

Open Derp7777 opened 5 years ago

Derp7777 commented 5 years ago

currently, we have 3 different schedules for every different lunch day. We should combind them into one for every schedule by using a dictionary of key-value pairs (eg {"A":[[lunch start], [p3 start]], "B":[[p3 start], [lunch start], [after lunch p3 start]], "C":[[p3 start], [lunch start]]})

Note: Depending on lunch, clock will need to read from an array of varying length, it should check if the time is after the final time, if not the time before that, if not the time before that, so on and so forth until all values have been checked. This check will not be necessary during any time that is not between immediately after p2 and immediately before p4.

psvenk commented 5 years ago

I agree, and I would like to add on that for schedules that have the same schedule for all three lunches, we could have something like scheduleExample = { "all": [ ... ] }.

psvenk commented 5 years ago

Disregard my previous comment: as @Derp7777 said, the A, B, and C arrays within the objects for each schedule will replace period 3 and lunch (if I understand correctly). Therefore, something like:

var schedule = {
  0: [
    ["morning",0,0],
    ...,
    ["2", 9, 48],
    ["_LUNCH", 11, 8],
    ["4", 13, 10],
    ...
  ],
  "A": [...], "B": [...], "C": [...]
}

with the arrays schedule.A, schedule.B, and schedule.C being the parts specific to each lunch, replacing the "_LUNCH" block. We would need some code to check if the current block’s label is "_LUNCH", and defer to the proper lunch’s special schedule if so. Schedules with invariant lunch would simply not have a "_LUNCH" block.