Commit 32e9add
committed
feat: filter PDF reports by current year
Ensures that all generated PDF reports (grades, presence, academic, and financial) only include data relevant to the current year.
Changes include:
- **api/students/views.py**:
- Updated `download_presence_pdf` to filter `Presence` records by `date__year=current_year`.
- Modified `download_academic_report` and `download_financial_report` to define `current_year` and pass it to their respective report generation functions.
- **api/utils/reports.py**:
- Updated `generate_student_academic_report` to accept a `year` parameter (defaulting to current year) and apply it to all `Grade`, `Presence`, `Warning`, and `Suspension` queries.
- Updated `generate_financial_report` to accept a `year` parameter (defaulting to current year) and apply it to `Tuition` queries using `reference_month__year=year`.1 parent db9de86 commit 32e9add
2 files changed
Lines changed: 39 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
| |||
116 | 119 | | |
117 | 120 | | |
118 | 121 | | |
119 | | - | |
120 | | - | |
| 122 | + | |
121 | 123 | | |
122 | | - | |
| 124 | + | |
123 | 125 | | |
124 | 126 | | |
125 | 127 | | |
| |||
364 | 366 | | |
365 | 367 | | |
366 | 368 | | |
367 | | - | |
368 | | - | |
| 369 | + | |
369 | 370 | | |
370 | 371 | | |
371 | | - | |
| 372 | + | |
372 | 373 | | |
373 | 374 | | |
374 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
48 | | - | |
49 | | - | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
54 | | - | |
55 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
56 | 64 | | |
57 | 65 | | |
58 | | - | |
59 | | - | |
60 | | - | |
| 66 | + | |
| 67 | + | |
61 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
62 | 72 | | |
63 | 73 | | |
64 | 74 | | |
| |||
174 | 184 | | |
175 | 185 | | |
176 | 186 | | |
177 | | - | |
| 187 | + | |
178 | 188 | | |
| 189 | + | |
| 190 | + | |
179 | 191 | | |
180 | 192 | | |
181 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
182 | 196 | | |
183 | | - | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
184 | 200 | | |
185 | 201 | | |
186 | 202 | | |
| |||
0 commit comments