fix exam grading
This commit is contained in:
@@ -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),
|
||||
}
|
||||
}),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user