Skip to content

Commit

Permalink
feat: add check in capability for non hackers
Browse files Browse the repository at this point in the history
  • Loading branch information
njhuey committed Jan 25, 2024
1 parent 4b14163 commit 674f252
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 9 additions & 1 deletion apps/api/src/admin/participant_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ async def check_in_applicant(uid: str, associate: User) -> None:
record: Optional[dict[str, object]] = await mongodb_handler.retrieve_one(
Collection.USERS, {"_id": uid, "role": Role.APPLICANT}
)
if not record or record["status"] not in (Status.ATTENDING, Status.CONFIRMED):
if not record:
raise ValueError

try:
status = record["status"]
except KeyError:
raise RuntimeError

if status not in (Status.ATTENDING, Status.CONFIRMED):
raise ValueError

new_checkin_entry = (utc_now(), associate.uid)
Expand Down
1 change: 0 additions & 1 deletion apps/api/src/routers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ async def checkin(
) -> None:
"""Check in participant at IrvineHacks."""
try:
# TODO: non-hackers
await participant_manager.check_in_applicant(uid, associate)
except ValueError:
raise HTTPException(status.HTTP_404_NOT_FOUND)
Expand Down

0 comments on commit 674f252

Please sign in to comment.