Refactor grade calculation and improve course audit logging#1930
Merged
vikrantwiz02 merged 3 commits intoJul 13, 2026
Conversation
apply_demotion endpoint moves selected students one semester back (floored at sem 1); safe inverse of an accidental promotion — decrements curr_semester_no only, without deleting course registrations.
create_course_audit_log stored old/new data and versions into JSONField columns whose default encoder can't serialize Decimal (Course.version is a DecimalField). The course row saved first, then the audit log insert raised -> 500, leaving the course added in the DB while the UI showed failure (and "already exists" on retry). Coerce audit values to JSON-native types via DjangoJSONEncoder before saving.
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.
This pull request introduces several important improvements and fixes across the academic procedures, examination, and programme curriculum modules. The main highlights are the addition of a safe demotion endpoint for students, significant corrections to cumulative credit calculations (ensuring credits are only counted once per course and semester), and improved handling of JSON serialization in course audit logs.
Academic Procedures:
apply_demotionAPI and URL, allowing academic admins to safely move students back one semester if they were over-promoted. The demotion does not remove any course registrations, making it a safe corrective action. [1] [2]Examination Module:
Programme Curriculum Module:
These changes improve data integrity, user experience for academic admins, and reliability of student records and reporting.