Add a group-by-section#85
Conversation
…r section-based grade display
| {{ course_pk|json_script:"course_id"}} | ||
| <script type="module" src="{% static 'assignments/renderVersionModal.js' %}" defer></script> | ||
| <script type="module" src="{% static 'assignments/detail.js' %}" defer></script> | ||
| <script type="module" src="{% static 'assignments/detail.js' %}?v=20260222-2" defer></script> |
There was a problem hiding this comment.
ah, that's nice! I didn't know that this method can force refresh the cache.
There was a problem hiding this comment.
Useful if you have run an older version before. I think it was causing an issue with not adding the new button correctly. There's probably a way to do it dynamically too if there are future updates to detail.js for example.
IonMich
left a comment
There was a problem hiding this comment.
Thanks for the PR Alex! This is a useful UI element to add in the assignment detail page of the Bootstrap UI. Other than the minor get_section_in_course comment, everything else looks good!
| question_grades_dict[f'question_{i+1}_grade'] = qg | ||
| section = None | ||
| if submission.student: | ||
| section = submission.student.sections.filter( |
There was a problem hiding this comment.
Here, can we use get_section_in_course from students/models.py ?
Students who belong in multiple sections of different courses can appear in the database. There are safeguards so that a student always belongs to only one section of a course during initial import, but the role of get_section_in_course is to raise an error if a student accidentally belongs in multiple sections in the same course.
There was a problem hiding this comment.
Good point. Could do something like this and catch the error too. Maybe even replace the print with an displayed error.
try:
section = submission.student.get_section_in_course(assignment.course)
except ValueError as e:
print(f"Error: {e}")
section = None
There was a problem hiding this comment.
Yes that code should work. The print statement is also fine. I believe in the UI we are not properly displaying info anywhere for "unassigned section" / "multiple sections" students, so let's not display an error here. The chart UI in this PR already creates a violin for "Unassigned" students and that will be good enough indication to the TA that something needs fixing.
(I think the course detail page and/or the student detail page could show warnings for such situations, but that's probably separate from this PR.)
…_in_course method and handle ValueError
|
I think everything seems okay now. I was seeing if I could dynamically update scripts tags with something like v={hash}, but I would need to do a bit more research into doing that properly. |
Perhaps all the script tags could be updated like so,
Have GitHub Actions set an env var like |
Thank you Alex! I hadn't thought that this could be reliably automated easily - what you are suggesting would resolve the Ctrl+shift+R that I have to do after each In order to avoid that extra commit we could have ASSET_VERSION be calculated dynamically at runtime from the git SHA (something like Merging this one! |
For assignments (quizzes), added an option for the graph to group by section (violin style).