Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions apps/admin-dashboard/app/routes/_dashboard.students.remove.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Sentry from '@sentry/react-router';
import {
type ActionFunctionArgs,
data,
Expand Down Expand Up @@ -72,23 +73,27 @@ async function removeMembers(ids: string[]): Promise<number> {
let count = 0;

for (const batch of batches) {
const students = await db
.deleteFrom('students')
.where('id', 'in', batch)
.returning(['airtableId', 'email', 'firstName', 'slackId'])
.execute();

for (const student of students) {
job('student.removed', {
airtableId: student.airtableId as string,
email: student.email,
firstName: student.firstName,
sendViolationEmail: false,
slackId: student.slackId,
});
try {
const students = await db
.deleteFrom('students')
.where('id', 'in', batch)
.returning(['airtableId', 'email', 'firstName', 'slackId'])
.execute();

for (const student of students) {
job('student.removed', {
airtableId: student.airtableId as string,
email: student.email,
firstName: student.firstName,
sendViolationEmail: false,
slackId: student.slackId,
});
}

count += students.length;
} catch (e) {
Sentry.captureException(e);
}

count += students.length;
}

return count;
Expand Down Expand Up @@ -141,7 +146,3 @@ export default function RemoveMembersPage() {
</Modal>
);
}

export function ErrorBoundary() {
return <></>;
}