mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-09-07 11:55:43 +00:00
feat(exam): regrade action + stop inviting a re-take on a finished exam
Two fixes surfaced by actual candidate-flow testing: - Portal 'My registrations' always showed 'Take exam' regardless of whether the candidate had already finished — clicking it just hit attempt_already_submitted server-side. The registrations/mine response now carries the attempt's status; the row shows a Completed/Time expired badge once finished, or 'Resume exam' while still in progress, and only invites a fresh start when there's genuinely nothing yet. - Backoffice candidates panel: a Regrade button next to a SUBMITTED/EXPIRED sitting, calling the new POST /exam-attempts/:id/regrade — the officer's path to the same staff-triggered regrade, no SQL needed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import type {
|
||||
ExamIncident,
|
||||
CreateIncidentPayload,
|
||||
ResolveIncidentPayload,
|
||||
RegradeOutcome,
|
||||
} from '../types/exam';
|
||||
|
||||
const examApi = baseApi.injectEndpoints({
|
||||
@@ -92,6 +93,14 @@ const examApi = baseApi.injectEndpoints({
|
||||
}),
|
||||
invalidatesTags: ['Api'],
|
||||
}),
|
||||
/** Staff-triggered re-run of auto-grading for one finalized attempt. */
|
||||
regradeAttempt: builder.mutation<RegradeOutcome, string>({
|
||||
query: (attemptId) => ({
|
||||
url: `/exam-attempts/${attemptId}/regrade`,
|
||||
method: 'POST',
|
||||
}),
|
||||
invalidatesTags: ['Api'],
|
||||
}),
|
||||
}),
|
||||
overrideExisting: false,
|
||||
});
|
||||
@@ -109,4 +118,5 @@ export const {
|
||||
useGetExamIncidentsQuery,
|
||||
useRecordIncidentMutation,
|
||||
useResolveIncidentMutation,
|
||||
useRegradeAttemptMutation,
|
||||
} = examApi;
|
||||
|
||||
Reference in New Issue
Block a user