Repository navigation
feat(examination): dynamic expected completion year in result PDF/transcript - #2017
Open
dreamweaver19 wants to merge 1 commit into
Open
dreamweaver19 wants to merge 1 commit into
dreamweaver19 wants to merge 1 commit into
Conversation
…nscript Adds the certificate sentence to student result PDFs and transcript PDFs: 'It is expected that 8th semester result will be declared in the month of July/August 2027.' where the year and semester number are fully dynamic — never hardcoded. Source of truth (existing DB fields, no new models or migrations): Batch.year → student admission year Batch.curriculum.no_of_semester → programme length (8 B.Tech, 4 M.Tech) Formula: batch.year + (no_of_semester // 2) Examples: UG2023 B.Tech (8 sems) → July/August 2027 UG2024 B.Tech (8 sems) → July/August 2028 PG2023 M.Tech (4 sems) → July/August 2025 Changes in FusionIIIT/applications/examination/api/views.py: 1. get_expected_completion_year(student) — new module-level helper added after format_semester_display(). Uses Batch→Curriculum path; falls back to legacy Student.batch + 4 when curriculum FK is null; returns None gracefully so PDFs still generate when data is missing. 2. expected_completion_year field added to student_info dict in: - GenerateTranscript (acadadmin transcript API) - CheckResultView (student self-service result API) - GenerateStudentResultPDFAPI DB-fetch path 3. Certificate sentence added just before the 'computer-generated document' footer in both PDF generation code paths (generate_student_result_pdf in GeneratePDFAPI and GenerateStudentResultPDFAPI). Sentence is rendered only when completion_year is non-null. Tests: 32/32 passed - All B.Tech batches 2021-2024 produce correct distinct years - M.Tech (4 sems) produces different year than B.Tech (8 sems) - Fallback paths (null curriculum, null batch_id FK) - Sentence format matches spec exactly - Ordinal suffixes 1st/2nd/3rd/4th/8th/11th/12th/13th/21st No migrations. No model changes. No frontend changes required.
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.
Context
This PR targets
prod/acad-react(the correct production branch).The previous PR #2009 was closed because it targeted the stale
examination-v1branch. The approval-sheet improvements from that PR were already merged by @vikrantwiz02 in PR #2011. This PR adds the one remaining piece: the dynamic expected completion year in student result PDFs and transcripts.What this adds
A certificate sentence in the student result PDF / marksheet:
where every value is dynamically computed — nothing hardcoded.
Source of truth (existing DB, no new models or migrations)
Batch.yearBatch.curriculum.no_of_semester(8 for B.Tech, 4 for M.Tech)batch.year + (no_of_semester // 2)Examples:
2023 + 4 = 20272024 + 4 = 20282023 + 2 = 2025Changes — one file only
FusionIIIT/applications/examination/api/views.pyget_expected_completion_year(student)— new module-level helper afterformat_semester_display(). UsesBatch→Curriculumpath; falls back to legacyStudent.batch + 4when curriculum FK is null; returnsNonegracefully (PDF still generates, sentence simply omitted).expected_completion_yearadded tostudent_infodict in:GenerateTranscript(acadadmin)CheckResultView(student self-service)GenerateStudentResultPDFAPIDB-fetch pathCertificate sentence added before the existing footer in both PDF generation code paths. Only rendered when year is non-null.
Tests — 32/32 passed ✅
get_expected_completion_year()helper (all programmes + fallbacks)Checklist
prod/acad-react(latest production branch)