Let a course nobody is assigned to be graded - #1961
Merged
vikrantwiz02 merged 1 commit intoAug 20, 2026
Merged
Conversation
A project course can have no offering at all: PR3003 Optional Project has no CourseInstructor row, and all 86 of its registrations therefore carry no offering. Uploading grades for it answered "No students are registered in the selected section for this course" even though the student was plainly registered, because the roster narrowed itself against an empty set of sections -- `None not in my_sections` is true of an empty set as well as of a set of named sections, so both halves of the section filter matched nothing. The narrowing now requires a section to exist, which is what the surrounding comment always intended: a course with no offering behaves like a no-section elective and owns all of its registrants. Sectioned courses keep their present behaviour, since their set of sections is not empty. Uploading the real grade sheet for PR3003 answers 200 where it answered 400.
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.
Symptom
Uploading a grade sheet for
PR3003 — Optional Projectanswers:while the very same screen lists the student as Registered — because that preview table is built client-side from the CSV, so it shows a roster the server has already rejected.
Cause
The course has no offering at all, and every one of its registrations therefore carries none:
The roster in
UploadGradesProfAPInarrows by section like this:Its own comment says a no-section (elective) offering owns all registrants — the
None in my_sectionscase. But an empty set also satisfiesNone not in my_sections, so for a course with no offering the filter runs with two empty sets, matches nothing, and reports the roster as empty.Fix
Require that a section actually exists before narrowing:
A course with no offering now behaves like a no-section elective and owns all of its registrants. Sectioned courses are untouched, their set of sections being non-empty.
Verified through the real endpoint with the actual grade sheet:
POST /examination/api/upload_grades_prof/for PR3003, 2025-26 Even, returns 200 where it returned 400. The grade row that test wrote was removed afterwards; PR3003 is back to its 57 historical rows with none for 2025-26.manage.py checkclean, no migrations.Worth a separate look
This is also a data condition: 86 students are registered in a course with no instructor assigned, so nothing in Course Instructors records who owns it. Grading works now regardless, but on the faculty side a professor with no offering still gets "Access denied: you are not assigned to teach this course this term" — correct by the letter, confusing for whoever actually supervises those projects.