hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | //! The `karne_snapshot` table: the frozen per-student, per-term report card |
| 2 | //! written when a term is archived. |
| 3 | //! |
| 4 | //! A report card is a *computed* read (D8) — per-instance weighted average, |
| 5 | //! graded against the school's bands, then a `ders_saati`-weighted year |
| 6 | //! average. The snapshot exists for the moment that computation must stop |
| 7 | //! moving: once a term is archived, the report is a record of what the school |
| 8 | //! issued, and a later correction to a mark must not silently rewrite a report |
| 9 | //! card a family already holds. [`crate::service::karne::freeze`] writes the |
| 10 | //! rows; [`crate::service::karne::build`] serves the snapshot back for an |
| 11 | //! archived term and computes live for an open one. |
| 12 | |
| 13 | use Json; |
| 14 | |
| 15 | use crateDatabase; |
| 16 | use crateTermId; |
| 17 | use crateTimestamp; |
| 18 | use crateUserId; |
| 19 | use crateAppError; |
| 20 | |
| 21 | /// Write (or refresh) `user`'s frozen report for `term`. |
| 22 | /// |
| 23 | /// An upsert rather than an insert: freezing is idempotent and converges — |
| 24 | /// archiving an already-archived term writes nothing |
| 25 | /// ([`crate::db::term::archive`]), and a re-run recomputes the same payload |
| 26 | /// from the same rows, so overwriting it is a no-op in substance and one |
| 27 | /// statement instead of an existence dance. |
| 28 | pub async |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | /// `user`'s frozen report for `term`, or `None` when that term was never |
| 51 | /// frozen (or they had no roster row to freeze). |
| 52 | pub async |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 |