家长端课程管理移除跟读录音、语法检测分数、孩子错题本卡片,只保留课程编辑与每周检测成绩
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
f80a931ef0
commit
ab84bec1b4
@@ -191,90 +191,12 @@ export default async function ParentPage() {
|
||||
passed: w.passed,
|
||||
}));
|
||||
|
||||
// ===== 单词跟读录音(课程管理回放) =====
|
||||
const recRows = await db
|
||||
.select({
|
||||
childName: users.displayName,
|
||||
word: wordRecording.word,
|
||||
ossKey: wordRecording.ossKey,
|
||||
createdAt: wordRecording.createdAt,
|
||||
})
|
||||
.from(wordRecording)
|
||||
.innerJoin(users, eq(users.id, wordRecording.childUserId))
|
||||
.where(eq(users.familyId, parent.familyId))
|
||||
.orderBy(desc(wordRecording.createdAt))
|
||||
.limit(20);
|
||||
const recordings = recRows.map((r) => ({
|
||||
childName: r.childName,
|
||||
word: r.word,
|
||||
url: viewUrl(r.ossKey),
|
||||
at: dstr(r.createdAt),
|
||||
}));
|
||||
|
||||
// ===== 英语语法检测明细 =====
|
||||
const grammarRows = await db
|
||||
.select({
|
||||
childName: users.displayName,
|
||||
title: grammarPoints.title,
|
||||
score: grammarProgress.score,
|
||||
passed: grammarProgress.passed,
|
||||
completedAt: grammarProgress.completedAt,
|
||||
})
|
||||
.from(grammarProgress)
|
||||
.innerJoin(users, eq(users.id, grammarProgress.childUserId))
|
||||
.innerJoin(grammarPoints, eq(grammarPoints.pointId, grammarProgress.pointId))
|
||||
.where(eq(users.familyId, parent.familyId))
|
||||
.orderBy(desc(grammarProgress.completedAt))
|
||||
.limit(20);
|
||||
const grammarTests = grammarRows.map((g) => ({
|
||||
childName: g.childName,
|
||||
title: g.title,
|
||||
score: g.score ?? 0,
|
||||
passed: g.passed,
|
||||
at: g.completedAt ? dstr(g.completedAt) : "",
|
||||
}));
|
||||
|
||||
// ===== 孩子错题数据 =====
|
||||
const wrongRows = await db
|
||||
.select({
|
||||
childName: users.displayName,
|
||||
question: wrongBook.question,
|
||||
userAnswer: wrongBook.userAnswer,
|
||||
correctAnswer: wrongBook.correctAnswer,
|
||||
sourceTitle: wrongBook.sourceTitle,
|
||||
mastered: wrongBook.mastered,
|
||||
})
|
||||
.from(wrongBook)
|
||||
.innerJoin(users, eq(users.id, wrongBook.childUserId))
|
||||
.where(eq(users.familyId, parent.familyId))
|
||||
.orderBy(desc(wrongBook.createdAt))
|
||||
.limit(30);
|
||||
const wrongItems = wrongRows.map((w) => {
|
||||
let stem = "";
|
||||
try {
|
||||
stem = (JSON.parse(w.question) as { stem?: string }).stem ?? "";
|
||||
} catch {
|
||||
stem = "";
|
||||
}
|
||||
return {
|
||||
childName: w.childName,
|
||||
stem,
|
||||
userAnswer: w.userAnswer ?? "",
|
||||
correctAnswer: w.correctAnswer ?? "",
|
||||
sourceTitle: w.sourceTitle ?? "",
|
||||
mastered: w.mastered,
|
||||
};
|
||||
});
|
||||
|
||||
return (
|
||||
<ParentDashboard
|
||||
overview={overview}
|
||||
templates={templates}
|
||||
devices={devices}
|
||||
weekly={weekly}
|
||||
recordings={recordings}
|
||||
grammarTests={grammarTests}
|
||||
wrongItems={wrongItems}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user