Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API check-in system modifications #342

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Changes from 2 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
20 changes: 16 additions & 4 deletions apps/api/src/admin/participant_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import Any, Optional

from auth.user_identity import User, utc_now
from models.ApplicationData import Decision
from services import mongodb_handler
from services.mongodb_handler import Collection
from utils.user_record import Role, Status, UserRecord
Expand All @@ -17,11 +18,22 @@ class Participant(UserRecord):
status: Status


async def get_attending_applicants() -> list[Participant]:
"""Fetch all applicants who have a status of ATTENDING"""
async def get_hackers() -> list[Participant]:
"""Fetch all applicants who have a status of ATTENDING, WAIVER_SIGNED, CONFIRMED,
or WAITLISTED."""
records: list[dict[str, Any]] = await mongodb_handler.retrieve(
Collection.USERS,
{"role": Role.APPLICANT, "status": Status.ATTENDING},
{
"role": Role.APPLICANT,
"status": {
"$in": [
Status.ATTENDING,
Status.WAIVER_SIGNED,
Status.CONFIRMED,
Decision.WAITLISTED,
]
},
},
[
"_id",
"status",
Expand All @@ -39,7 +51,7 @@ 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"] != Status.ATTENDING:
if not record or record["status"] not in (Status.ATTENDING, Status.CONFIRMED):
raise ValueError

new_checkin_entry = (utc_now(), associate.uid)
Expand Down
Loading