feat(exams,homework): add error collection data-access for error book integration
- Add data-access-error-collection in exams module for collecting wrong exam answers - Add data-access-error-collection in homework module for collecting wrong homework answers - Update exams actions, exam-ai-generator, data-access, and types - Update homework actions and data-access-write
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
||||
getExamGrades,
|
||||
getExamPreview,
|
||||
getExamSubjects,
|
||||
getExamsByGradeId,
|
||||
persistAiGeneratedExamDraft,
|
||||
persistExamDraft,
|
||||
resolveSubjectGradeNames,
|
||||
@@ -39,6 +40,7 @@ import type {
|
||||
AiPreviewData,
|
||||
AiRewriteQuestionData,
|
||||
} from "./ai-pipeline"
|
||||
import type { GradeExamsResult } from "./types"
|
||||
export type { AiPreviewData, AiRewriteQuestionData } from "./ai-pipeline"
|
||||
|
||||
const ExamCreateSchema = z.object({
|
||||
@@ -850,4 +852,30 @@ export async function getGradesAction(): Promise<ActionState<{ id: string; name:
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 年级仪表盘 - 维度3:获取年级下所有考试 + 提交统计。
|
||||
*/
|
||||
export async function getExamsByGradeIdAction(
|
||||
gradeId: string
|
||||
): Promise<ActionState<GradeExamsResult>> {
|
||||
try {
|
||||
const ctx = await requirePermission(Permissions.EXAM_READ)
|
||||
|
||||
if (!gradeId || gradeId.trim().length === 0) {
|
||||
return failState<GradeExamsResult>("Invalid grade id")
|
||||
}
|
||||
|
||||
const result = await getExamsByGradeId({
|
||||
gradeId,
|
||||
scope: ctx.dataScope,
|
||||
})
|
||||
return successState(result)
|
||||
} catch (error) {
|
||||
if (error instanceof PermissionDeniedError) {
|
||||
return failState<GradeExamsResult>(error.message)
|
||||
}
|
||||
return handleActionError(error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user