From 39086057868fcaf295a8492c39eec7d18a450898 Mon Sep 17 00:00:00 2001 From: Aydan Pirani Date: Tue, 17 Sep 2024 22:49:47 -0500 Subject: [PATCH] Fixed checkin event issue --- src/services/checkin/checkin-utils.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/services/checkin/checkin-utils.ts b/src/services/checkin/checkin-utils.ts index fdffc78..3befb90 100644 --- a/src/services/checkin/checkin-utils.ts +++ b/src/services/checkin/checkin-utils.ts @@ -83,6 +83,13 @@ async function assignPixelsToUser(userId: string, pixels: number) { ); } +export async function markUserAsCheckedIn(userId: string) { + await Database.ATTENDEE.findOneAndUpdate( + { userId }, + { hasCheckedIn: true } + ); +} + export async function checkInUserToEvent( eventId: string, userId: string, @@ -91,7 +98,9 @@ export async function checkInUserToEvent( await checkEventAndAttendeeExist(eventId, userId); await checkForDuplicateAttendance(eventId, userId); - if (!isCheckin) { + if (isCheckin) { + await markUserAsCheckedIn(userId); + } else { await updateAttendeePriority(userId); }