Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 50x 219x 219x 219x 13098x 4717x 12710x 12710x 1698x 19162x 917x 917x 1698x 917x 917x 219x 219x | import { ProgramItem } from "shared/types/models/programItem";
import { User } from "shared/types/models/user";
import { logger } from "server/utils/logger";
export const getGroupCreators = (
users: readonly User[],
startingProgramItems: readonly ProgramItem[],
): User[] => {
logger.debug("Get group creators");
// Get users who have lottery sign-ups for starting program items
const selectedAttendees: User[] = [];
for (const user of users) {
// Only individuals and group creators carry lottery sign-ups into the assignment.
// A non-creator member's sign-ups must not turn them into a group creator, which
// would duplicate the group when its members are expanded
if (user.groupCode !== "0" && !user.isGroupCreator) {
continue;
}
let match = false;
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < user.lotterySignups.length; i += 1) {
for (const startingProgramItem of startingProgramItems) {
if (
user.lotterySignups[i].programItemId ===
startingProgramItem.programItemId
) {
match = true;
break;
}
}
// User matched, break
if (match) {
selectedAttendees.push(user);
break;
}
}
}
logger.debug(
`Found ${selectedAttendees.length} group creators for this start time`,
);
return selectedAttendees;
};
|