diff --git a/.vscode/settings.json b/.vscode/settings.json index b09b4e0..47bf9b0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,8 @@ "editor.formatOnSave": true, "prettier.printWidth": 160, "prettier.tabWidth": 2, - "cSpell.words": ["fallstack"] + "cSpell.words": ["fallstack"], + "[dotenv]": { + "editor.defaultFormatter": "foxundermoon.shell-format" + } } diff --git a/src/lib/completeAction.ts b/src/lib/completeAction.ts index ddab744..78bf032 100644 --- a/src/lib/completeAction.ts +++ b/src/lib/completeAction.ts @@ -9,6 +9,15 @@ export async function completeAction(studentCode: string, actionName: string) { if (!action) return null; + const alreadyCompleted = await prisma.actionCompletion.findFirst({ + where: { + studentCode, + actionId: action.id, + }, + }); + + if (alreadyCompleted) return null; + const studentAction = await prisma.actionCompletion.create({ data: { studentCode,