Add 'approve without feedback' button for homework review
Curators/admins can mark a submission APPROVED (and complete the lesson) without writing feedback. The student sees 'ДЗ принято ✓' and can no longer resubmit. No email is sent on silent approval. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -108,6 +108,51 @@ export async function setReviewing(submissionId: string) {
|
||||
revalidatePath(`/curator/homework/${submissionId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Принять ДЗ без письменного ответа: ставим APPROVED и засчитываем урок,
|
||||
* фидбек не создаём и студенту письмо не шлём (тихое принятие).
|
||||
*/
|
||||
export async function approveWithoutFeedback(submissionId: string) {
|
||||
await requireCurator();
|
||||
|
||||
const submission = await prisma.homeworkSubmission.findUnique({
|
||||
where: { id: submissionId },
|
||||
include: {
|
||||
homework: {
|
||||
include: {
|
||||
lesson: {
|
||||
select: {
|
||||
id: true,
|
||||
module: { select: { course: { select: { slug: true } } } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!submission) throw new Error("Submission not found");
|
||||
|
||||
const lesson = submission.homework.lesson;
|
||||
|
||||
await prisma.$transaction(async (tx) => {
|
||||
await tx.homeworkSubmission.update({
|
||||
where: { id: submissionId },
|
||||
data: { status: "APPROVED", statusAt: new Date() },
|
||||
});
|
||||
await tx.lessonProgress.upsert({
|
||||
where: { userId_lessonId: { userId: submission.userId, lessonId: lesson.id } },
|
||||
create: { userId: submission.userId, lessonId: lesson.id },
|
||||
update: {},
|
||||
});
|
||||
});
|
||||
|
||||
revalidatePath("/curator/homework");
|
||||
revalidatePath(`/curator/homework/${submissionId}`);
|
||||
revalidatePath(`/courses/${lesson.module.course.slug}/lessons/${lesson.id}`);
|
||||
revalidatePath(`/courses/${lesson.module.course.slug}`);
|
||||
revalidatePath("/dashboard");
|
||||
}
|
||||
|
||||
export async function deleteSubmission(submissionId: string) {
|
||||
await requireCurator();
|
||||
await prisma.homeworkSubmission.delete({ where: { id: submissionId } });
|
||||
|
||||
Reference in New Issue
Block a user