Repository navigation
Update sections on re-import; let admins edit a section's staff and capacity - #28
Merged
Merged
Conversation
…apacity Importing the Sections sheet again used to add a second copy of every section. Now a row with the same type, day, time and location as an existing section updates that section's staff, capacity, tags and self-enrollment, keeping its students. When several sections share a time and place (e.g. "Online"), the staff email tells them apart. Rows that match nothing are added, sections missing from the sheet are kept, and the import reports how many sections it added and updated. The import modal explains this. Admins can also change a section's staff member and capacity from its Settings tab, so swapping TAs no longer needs a reset and re-import. Neither path can set a capacity below the section's enrollment. Fixes #3, fixes #17. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
🚀 Staging Preview Deployed! URL: https://preview-sections-pr-28-137456085712.us-west1.run.app |
The staff field in a section's Settings tab was a text box for an email. As described on #17, it's now a dropdown of everyone on staff in the course (from a new admin-only list_staff API), plus "Unassigned", and update_section_staff takes the chosen person's id. Submitting settings gave no sign that anything happened unless it failed, and errors appear at the top of the page, out of view of the button. The changes are now sent one at a time while the button shows "Saving…", and a message beside the button says whether they all saved, how many did if some failed, or that there was nothing to save. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A person's role in an offering is only synced with Canvas when they open its pages, so the staff dropdown missed TAs who had signed in but not yet opened the course, and kept TAs removed from the Canvas course. For anyone who has signed in, the dropdown and update_section_staff now go by their Canvas roles from their last sign-in. People imported from a spreadsheet who haven't signed in still go by their role here. Assigning a section to someone on staff in Canvas also records that role here. Global admins aren't listed unless they're on staff in this course in Canvas. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Settings sends its changes one at a time, so when the capacity failed before a new location was saved, the message named the old location. It now just says the capacity can't go below the enrollment. In the import, where several sections may be updated, the message starts with the sheet's row number instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rror A day or time the parser couldn't read (a lowercase "m", "10am", "8:30a" without the leading 0, "10:00" without a or p, or "13:00p") raised a plain Python error, so the Settings tab and the sheet imports only said "Something went wrong." (see #7). They now say what was wrong and what form is expected. "10:00x" used to be saved as 10:00a and is now rejected, and a section can no longer end at or before its start. Sheet import errors about times name the row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
|
remaining bug: in the time parser, 12:30a is read as 12:30 p.m., not 12:30 a.m. This is not fixed because a section at that hour is unlikely and changing how times are read could stop enrollment imports from matching existing sections. |
A rejected value, like "weds" for the day, stayed in its field, so the next submit sent it again. After submitting, the Settings tab now loads the section again and fills every field with its saved value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3 and fixes #17.
Re-importing sections (#3)
Importing the Sections sheet a second time used to add another copy of every section. Now:
Editing a section (#17)
In a section's Settings tab, admins can now set:
Staff Member: a dropdown plus "Unassigned", as described in this comment on #17. Swapping TAs no longer needs a reset and re-import. The list shows:
Global admins aren't listed unless they're a TA or teacher in this course on bCourses. Assigning a section to someone who is staff in bCourses but hasn't opened this course in Sections yet also records their staff role here.
Capacity
Both the Settings tab and the import refuse a capacity below the section's current enrollment, as requested in #3. A capacity error from a re-import starts with the sheet's row number.
Clearer day and time errors (related to #7)
A day or time that couldn't be read used to cause a server error, so the Settings tab and both sheet imports only said "Something went wrong." This was one cause of the uninformative errors in #7, which this PR doesn't close. Now, in the Settings tab and both imports:
10am,8:30aor10:00) gives an error showing the expected form, like 08:30a or 02:15p.13:00p) gives "isn't a time on a 12-hour clock".10:00xused to be saved as 10:00 a.m.; it's now rejected.Submit Changes now gives feedback. Changes are sent one at a time while the button shows "Saving…". A message beside the button then says the settings saved, says how many saved if any failed (each error also shows at the top of the page), or says there was nothing to save. After a submit, every field is refilled with the section's saved value, so a rejected value isn't left in its field to be sent again.
Testing
pytest serverpasses on SQLite (58 tests).yarn typecheck,yarn lintandyarn buildpass.Follow-up
Per #3, berkeley-cdss/docs#76 updates the sections docs for the re-import behavior and the new Settings fields. Merge it after this PR is deployed.
🤖 Generated with Claude Code