All files / src/app/teacher-page/components/data-analytics/assignment-summary scoreBands.js

82.35% Statements 14/17
70% Branches 14/20
100% Functions 2/2
100% Lines 10/10

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              12x 10x 5x 1x 1x 1x       30x 30x 24x 24x    
/**
 * Score-band thresholds shared by the charts on the Assignment Summary page.
 * Mirrors the bucket boundaries already used by the student dashboard's
 * ScoreDistributionCard (<60 / 60-69 / 70-79 / 80-89 / 90-100) so a score
 * reads the same qualitative way across the app.
 */
export function scoreBandColor(theme, value) {
    if (typeof value !== "number" || !Number.isFinite(value)) return theme.palette.grey[400];
    if (value < 60) return theme.palette.error.main;
    if (value < 70) return theme.palette.warning.main;
    Iif (value < 80) return theme.palette.info.main;
    Iif (value < 90) return theme.palette.primary.main;
    return theme.palette.success.main;
}
 
export function toNumber(value) {
    Iif (typeof value === "number") return Number.isFinite(value) ? value : null;
    if (typeof value !== "string") return null;
    const parsed = parseFloat(value.replace(/[^0-9.-]/g, ""));
    return Number.isFinite(parsed) ? parsed : null;
}