Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 31x 27x 22x 82x 31x 29x 15x 7x 4x | /**
* EI-2966 — Student Dashboard GPA-card display helpers.
*
* Pure formatting helpers consumed by `GpaCard.jsx`. Backs the
* `GET /v1/student/dashboard/gpa/fetch` endpoint shipped in
* eruditiontx-services-mvp PR feat/ei-2966-gpa-endpoint.
*
* - `formatGpaAverage(value)` — returns the user-facing string
* for a numeric average grade. Strict: `null`/`undefined`/
* non-finite → `"—"` (em-dash) so the card renders an empty
* state instead of a misleading "0.00".
* - `gpaBandLabel(value)` — returns a short qualitative label
* for a numeric average ("Excellent" / "Good" / "Passing" /
* "Needs work" / null). Useful as a Chip color/title hint.
*/
export function formatGpaAverage(value) {
if (value === null || value === undefined) return "—";
if (typeof value !== "number" || !Number.isFinite(value)) return "—";
return value.toFixed(2);
}
export function gpaBandLabel(value) {
if (value === null || value === undefined) return null;
if (typeof value !== "number" || !Number.isFinite(value)) return null;
if (value >= 90) return "Excellent";
if (value >= 80) return "Good";
if (value >= 70) return "Passing";
return "Needs work";
}
|