Repository navigation
feat(examination): dynamic heading, center alignment, auto subject numbering in approval sheet - #2009
Closed
dreamweaver19 wants to merge 1 commit into
Conversation
…mbering in approval sheet
REQ-1 – Dynamic approval-sheet heading
- Added _ordinal_suffix() helper to produce '1st', '2nd', '3rd', '6th', etc.
- Added _derive_academic_year() helper that reads the AY from Student_grades
records (primary source) with a fallback formula based on batch admission
year + semester number (pairs 1-2, 3-4, 5-6, 7-8 share the same AY).
- Row 1 of the Excel now contains the institute name (full-width merged cell,
blue background).
- Row 2 contains the fully dynamic heading, e.g.
'Approval sheet for Even Semester AY2025-26 (UG2023 Batch (CSE) - SEM-6th)'
No values are hardcoded; all components are derived from request params and
database records.
REQ-2 – Excel header alignment
- S.No / Roll No / Name columns are now merged across all five header rows
(rows 3-7) to match the multi-row course columns.
- The mass-fill loop now explicitly sets Alignment(horizontal='center',
vertical='center', wrap_text=True) on every header cell, covering both
merged-cell anchors and standalone cells (SPI/CPI tail columns).
- Title rows 1-2 are also center-aligned.
REQ-3 – Automatic sequential subject numbering
- Courses queryset now uses .order_by('code') for deterministic ordering.
- A dedicated subject-number row is added above the course-code row; numbers
are generated with enumerate(courses_list, start=1) so they automatically
adjust when subjects are added or removed.
- The same courses_list drives both the header block and the per-student grade
loop, guaranteeing identical order in web preview and downloaded Excel.
No migrations, no model changes, no serializer changes, no frontend changes.
Existing API contract and Acad Admin permission check are preserved.
Collaborator
|
Congratulations for making your first Pull Request at Fusion!! 🎉 Someone from our team will review it soon. |
Member
|
@dreamweaver19, this was not the latest branch, and due to this it have many conflicts and can't get merged in production. I'm pulling your code changes and raising PR again into branch prod/acad-react. |
Member
|
Closing this PR. |
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.
Summary
Three improvements to the Examination approval-sheet Excel generation (
GenerateResultAPIinexamination/api/views.py). No database migrations, no model changes, no serializer changes, no frontend changes required.Changes
REQ-1 – Dynamic Approval-Sheet Heading
Approval sheet for Even Semester AY2025-26 (UG2023 Batch (CSE) - SEM-6th)Student_grades.academic_year(ground truth). A fallback formula computes it from batch admission year + semester number when no grade records exist yet (semester pairs 1-2, 3-4, 5-6, 7-8 share the same AY)._ordinal_suffix()static helper: 1→1st, 2→2nd, 3→3rd, 6→6th, 11→11th, etc._derive_academic_year()static helper with primary DB source + fallback.REQ-2 – Excel Header Alignment
horizontal="center"andvertical="center"alignment.center_alignto every header cell, so no cell is left without alignment regardless of future column additions.REQ-3 – Automatic Sequential Subject Numbering
.order_by('code')for deterministic, alphabetical ordering (previously unordered / PK order).enumerate(courses_list, start=1).courses_list(evaluated once) drives both the Excel header block and the per-student grade data loop, guaranteeing identical subject order between the web preview and the downloaded Excel.Files Modified
FusionIIIT/applications/examination/api/views.pyGenerateResultAPI: added 2 helpers, rewrote Excel generation block (201 insertions, 76 deletions)Testing
38/38 tests passed (pure-Python, no DB required):
Test script:
.agents/tasks/test_approval_sheet.pyChecklist
role == "acadadmin")