fix exam grading

This commit is contained in:
root
2026-06-04 13:25:41 -04:00
parent 1af02dadd3
commit ad7b13f4d8
17 changed files with 853 additions and 46 deletions
+7 -3
View File
@@ -5,6 +5,10 @@ import { fetchParticipation, postParticipation } from '../../api/grading'
import { GRADING_PATH } from './gradingPaths'
/** CI `grading/participation.php` */
function normalizeParticipationScore(value: unknown): number | string | null {
return typeof value === 'number' || typeof value === 'string' ? value : null
}
export function ParticipationPage() {
const [searchParams] = useSearchParams()
const [rows, setRows] = useState<
@@ -17,7 +21,7 @@ export function ParticipationPage() {
}>
>([])
const [locked, setLocked] = useState(false)
const [title, setTitle] = useState('Participation Scores')
const [title] = useState('Participation Scores')
const [sectionName, setSectionName] = useState('')
const [semester, setSemester] = useState(searchParams.get('semester') ?? '')
const [schoolYear, setSchoolYear] = useState(searchParams.get('school_year') ?? '')
@@ -46,7 +50,7 @@ export function ParticipationPage() {
school_id: typeof student.school_id === 'string' ? student.school_id : null,
firstname: typeof student.firstname === 'string' ? student.firstname : null,
lastname: typeof student.lastname === 'string' ? student.lastname : null,
score: scores.score ?? null,
score: normalizeParticipationScore(scores.score),
}
}),
)
@@ -112,7 +116,7 @@ export function ParticipationPage() {
school_id: typeof student.school_id === 'string' ? student.school_id : null,
firstname: typeof student.firstname === 'string' ? student.firstname : null,
lastname: typeof student.lastname === 'string' ? student.lastname : null,
score: scores.score ?? null,
score: normalizeParticipationScore(scores.score),
}
}),
)