Skip to content

Add day-of-week picker - #257

Merged
psvenk merged 6 commits into
masterfrom
day-of-week-picker
Feb 8, 2021
Merged

psvenk merged 6 commits into
masterfrom
day-of-week-picker

Conversation

@jadebuckwalter

Copy link
Copy Markdown
Collaborator

Add a dropdown above the schedule to select the day of the week, and
update the schedule to match that day.

@jadebuckwalter

jadebuckwalter commented Feb 7, 2021 •

Copy link
Copy Markdown
Collaborator Author

Though the basic functionality has been implemented, this is still a work in progress. This is what remains:

  • Default to current day
  • Style the dropdown menu
  • Update clock to match dropdown
  • Update schedule to match dropdown
  • Clean up the code (that's on me)

@psvenk psvenk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes. While we should have a day-of-week dropdown, I am still wary of completely refactoring the code to rely on the day of the week and ditching black and silver days altogether, given that we will probably go back to a black/silver-based schedule post-covid. Many parts of the code use conditionals so that we can easily revert to the pre-covid behavior at any time.

Is there any technical reason why this refactoring is necessary, or would it be feasible to continue having the day of the week be used to compute whether it's a black or silver day as well as which schedule from schedule.json to use (covid-mt, covid-w, or covid-rf)? The main change would be that instead of directly using now.getDay() in those places, we could have a global variable day and do something like day || now.getDay() so that day, if set, overrides now. (We would also need some code using something like new Date().getDay() to set the dropdown to default to the current day of the week.)

@psvenk psvenk added this to the 2.6.3 milestone Feb 7, 2021
@jadebuckwalter jadebuckwalter linked an issue Feb 7, 2021 that may be closed by this pull request
2 tasks done
Add a dropdown above the schedule to select the day of the week, and
update the schedule to match that day.
Instead of using days of the week directly, use black and silver days
Rather than setting an inconsequential local variable, set a new global
variable for the day of week and make this control the clock.
Introduce a new function which reformats the schedule in the mold of the
specifications in schedule.json which outline the order of periods,
meaning that the schedule now displays the periods in the proper order,
including periods that do not have a class associated with them,
according to the day of the week (and, post-covid, whether a student has
lunch A, lunch B, or lunch C).
Add after-school classes to schedule.json so that they are displayed
once again in the schedule tab, but give them a close-to-zero timeframe
so that they are excluded from the clock (because there is no
standardized meeting time for these classes).
Respect the value of the day-of-week dropdown and the date override
throughout redraw_clock.
@psvenk
psvenk marked this pull request as ready for review February 8, 2021 03:28

@psvenk psvenk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jadebuckwalter, @tektaxi, and I have agreed that the styling can be addressed in a separate pull request, so this is ready to merge.

@psvenk
psvenk merged commit dc9c0ef into master Feb 8, 2021
@psvenk
psvenk deleted the day-of-week-picker branch February 8, 2021 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Additional changes to schedule tab for semester 2

2 participants