Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple Schedule pages #21

Open
philipmjohnson opened this issue Sep 20, 2023 · 6 comments
Open

Support multiple Schedule pages #21

philipmjohnson opened this issue Sep 20, 2023 · 6 comments
Assignees

Comments

@philipmjohnson
Copy link
Contributor

philipmjohnson commented Sep 20, 2023

Currently, Morea does not have good support for courses in which different sections are taught on different days. A typical example is one section on MW and another on TTh. In this case, a single Schedule page is problematic since an assignment will be due on different days depending upon the section. In the past, we have tried:

  • Creating two separate Morea sites, one for each section, that differ only in the start_date associated with assignments. The problem with this approach is keeping the two sites in sync and manually changing the other site each time the first one changes. That can create a lot of maintenance overhead.
  • Removing due dates from assignments, and using some other mechanism (such as Laulima). This creates its own problems, such as when there are "suggested" dates for tasks that are not officially Laulima assignments.

To provide better support for courses with different sections on different days, Morea could provide a backwards-compatible option that enables multiple schedule pages. In this approach, there would be: a flag in the _config.yml file to enable multiple schedule pages (disabled by default or if missing from the config file). If the flag is present and enabled, then the "Schedule" link in the nav bar will be converted into a dropdown menu with two items. Each item links to a separate schedule page. One schedule page is populated with the module start/end dates and the experience start dates (as is done currently). The second schedule page is populated with module start/end dates and experience start dates as indicated by a morea_start_date2 field in the front matter.

Implementing this involves:

  1. Create a branch named issue-021 in this repository to hold the changes.
  2. Create a new top-level folder called schedule2. The contents will be just like the schedule folder, except the calendar generated will be from a file called schedule-info2.js.
  3. Update the MoreaGenerator.rb file to write out a file called schedule-info2.js when the flag for generating a second schedule is present. This should contain the appropriate entries for the second schedule.
  4. Update the _layouts/core.html file to conditionally create the dropdown menu rather than a single link to the schedule page with the config.yml flag is set.
  5. Test.
  6. Document this option in the Morea docusaurus site.
  7. Merge into master.
@dport96
Copy link

dport96 commented Sep 24, 2023

Should we generalize this to more than two schedules? If so maybe Cam's idea to put the start/end dates in an array (or maybe an object) could work. Something like:

morea_start_date:
Section 001: 2021-07-26T23:00
Section 002: 2021-07-27T23:00
Section 003: 2021-07-28T23:00

When detected would automatically generate three top-level folders called schedule_Section_001, schedule_Section_002, schedule_003 and the dropdown menu would be populated with the properties of morea_start_date. We can avoid having to add a flag in _config.yml to indicate multiple schedules.

@dport96
Copy link

dport96 commented Sep 24, 2023

get_schedule_events() and set_due_dates() are going to get a little hacky or we have to make duplicate methods to enable getting the start/end dates for both schedules. Would it be better to have a flag in _config.yml that creates a second schedule that automatically shifts the start/end dates by +/- n days?

@philipmjohnson
Copy link
Contributor Author

philipmjohnson commented Sep 27, 2023

I like the array idea a lot. I'm not sure if the syntax is:

morea_start_date:
  - Section 001: 2021-07-26T23:00
  - Section 002: 2021-07-27T23:00
  - Section 003: 2021-07-28T23:00

or

morea_start_date:
  Section 001: 2021-07-26T23:00
  Section 002: 2021-07-27T23:00
  Section 003: 2021-07-28T23:00

As for the plus/minus idea, it's certainly a timesaver. I just worry that it is too inflexible. Maybe one section needs to deviate from a constant offset sometimes (due to illness or holidays or I dunno what)?

@dport96
Copy link

dport96 commented Sep 29, 2023

I've made an initial implementation of multiple schedules and an example in the issue-021 branch. It wasn't necessary but for clarity and consistency, I thought it would be useful to define course_sections in _config.yml rather than collecting them from the start dates. There's backward compatibility and hybrid compatibility (you can mix events with course sections and without). The selected section will be saved in localStorage and is used to set the default calendar so the user doesn't have to always select their section when viewing the schedule.

I didn't know how to handle modules with multiple sections for page.data['morea_start_date_string'] so it just uses dates for the last section defined in the page.data['morea_start_date'] hash.

To use multiple sections first define the sections in _config.yml like this:

course_sections:
  - "Section 01"
  - "Section 02"

Then for any morea_start_date or morea_end_date add the dates for each section as a hash:

morea_start_date:
  Section 001: 2021-07-26T23:00
  Section 002: 2021-07-27T23:00
  Section 003: 2021-07-28T23:00

The keys for this are not checked against course_sections and you can leave out sections or use different ones not defined (but these will not appear on the schedule). I'm not sure what or if section validation against course_sections should be done. You can also just use a single date (no hash) and this event will appear on the calendar for all sections.

Try it out and let me know if this seems to address the issue adequately before I make a pull request and document it in docusaurus.

@dport96 dport96 closed this as completed Nov 8, 2023
@dport96 dport96 reopened this Nov 8, 2023
@dport96
Copy link

dport96 commented Nov 8, 2023

We are trying the multiple schedules feature on https://courses.ics.hawaii.edu/ics314f23/ and so far no issues have been reported and it seems to serve the purpose. After the semester ends, I will write documentation and suggest merging into the current morea-framework branch.

One issue to address is handling default settings in localstorage for clients using multiple MOREA sites

@philipmjohnson
Copy link
Contributor Author

Works like a charm for 314. Once @dport96 gets around to writing documentation and merging into the morea template repo, I'll close this.

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

No branches or pull requests

2 participants