Skip to content

Commit

Permalink
Merge pull request #158 from ReflectionsProjections/dev/sdagg9/priority
Browse files Browse the repository at this point in the history
changed priority endpoint
  • Loading branch information
sdagg9 authored Sep 17, 2024
2 parents 04c7208 + 1d8cd97 commit 45b79a6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/services/stats/stats-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { StatusCodes } from "http-status-codes";
import { Database } from "../../database";
import RoleChecker from "../../middleware/role-checker";
import { Role } from "../auth/auth-models";
import { getCurrentDay } from "../checkin/checkin-utils";

const statsRouter = Router();

Expand Down Expand Up @@ -52,8 +53,11 @@ statsRouter.get(
RoleChecker([Role.enum.STAFF], false),
async (req, res, next) => {
try {
const day = getCurrentDay();
const dayField = `hasPriority.${day}`;
const attendees = await Database.ATTENDEE.find({
hasCheckedIn: true,
[dayField]: true,
});

return res.status(StatusCodes.OK).json({ count: attendees.length });
Expand Down

0 comments on commit 45b79a6

Please sign in to comment.