Skip to content

Commit

Permalink
feat: Revoke Certificate Requests on Deactivation (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonasdoubleyou authored Nov 28, 2023
1 parent 96a7210 commit fef1203
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions common/student/activation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { PrerequisiteError } from '../util/error';
import { logTransaction } from '../transactionlog/log';
import { isZoomFeatureActive } from '../zoom/util';
import { userForStudent } from '../user';
import { CertificateState } from '../certificate';

export async function deactivateStudent(student: Student, silent = false, reason?: string) {
if (!student.active) {
Expand All @@ -33,6 +34,12 @@ export async function deactivateStudent(student: Student, silent = false, reason
await dissolveMatch(match, dissolve_reason.accountDeactivated, student, dissolved_by_enum.student);
}

// Remove any pending certificates, so that they no longer show up in pupil dashboards
await prisma.participation_certificate.updateMany({
where: { studentId: student.id, state: CertificateState.awaitingApproval },
data: { state: CertificateState.manual },
});

//Delete course records for the student.
const courses = await prisma.course.findMany({
where: {
Expand Down

0 comments on commit fef1203

Please sign in to comment.