Remove scheduling cheerleader special case
Some checks failed
E2E Tests / e2e (push) Has been cancelled
Tests and checks on push / run-checks-and-tests (push) Has been cancelled
Updates translation progress / update-translation-progress-issue (push) Has been cancelled

This commit is contained in:
Kalle
2026-09-05 07:19:47 +03:00
parent b6e202c277
commit 41a56ed7d7
6 changed files with 14 additions and 22 deletions

View File

@@ -335,7 +335,7 @@ describe("AvailabilityRepository.findWeekReminderUserIds", () => {
expect(await reminderUserIds()).toEqual([]);
});
test("leaves cheerleaders out, the schedule surfaces do not show them", async () => {
test("reminds cheerleaders like any other member", async () => {
await TeamFactory.create(
{ memberUserIds: [users.id(1), users.id(2), users.id(3)] },
{ roles: { [users.id(3)]: "CHEERLEADER" } },
@@ -345,7 +345,7 @@ describe("AvailabilityRepository.findWeekReminderUserIds", () => {
weekStartsAt: WEEK_STARTS_AT,
});
expect(await reminderUserIds()).toEqual([users.id(2)]);
expect(await reminderUserIds()).toEqual([users.id(2), users.id(3)]);
});
});

View File

@@ -97,17 +97,11 @@ export async function hasReportedWeek({
/**
* Users who have not reported the week starting at `weekStartsAt` while a teammate has (a reminder
* is only worth sending then). Cheerleaders are left out, the schedule views do not show them.
* is only worth sending then).
*/
export async function findWeekReminderUserIds(weekStartsAt: number) {
const memberships = await db
.selectFrom("TeamMemberWithSecondary")
.where((eb) =>
eb.or([
eb("TeamMemberWithSecondary.role", "is", null),
eb("TeamMemberWithSecondary.role", "!=", "CHEERLEADER"),
]),
)
.leftJoin("AvailabilityWeek", (join) =>
join
.onRef("AvailabilityWeek.userId", "=", "TeamMemberWithSecondary.userId")

View File

@@ -51,7 +51,6 @@ export const action: ActionFunction = async ({ request, params }) => {
.filter(
(member) =>
member.id !== user.id &&
member.role !== "CHEERLEADER" &&
(!participantUserIds || participantUserIds.includes(member.id)),
)
.map((member) => member.id),
@@ -119,9 +118,7 @@ function validatedParticipantUserIds(
const userIds = data.participantUserIds.map(Number);
errorToastIfFalsy(
userIds.every((userId) =>
team.members.some(
(member) => member.id === userId && member.role !== "CHEERLEADER",
),
team.members.some((member) => member.id === userId),
),
"Participants must be members of the team",
);

View File

@@ -41,9 +41,7 @@ export const loader = async ({ params }: LoaderFunctionArgs) => {
meta: { teamCustomUrl: team.customUrl },
});
const members = team.members.filter(
(member) => member.role !== "CHEERLEADER",
);
const members = team.members;
const timezone = getViewerTimezone() ?? "UTC";
const now = new Date();

View File

@@ -495,12 +495,10 @@ function ParticipantUserIdsFormField() {
return (
<FormField
name="participantUserIds"
options={members
.filter((member) => member.role !== "CHEERLEADER")
.map((member) => ({
value: String(member.id),
label: () => member.username,
}))}
options={members.map((member) => ({
value: String(member.id),
label: () => member.username,
}))}
/>
);
}

View File

@@ -0,0 +1,5 @@
---
navItem: calendar
type: feature
---
Cheerleaders now show up on the team schedule like coaches and subs, can be picked as team event participants and get team event notifications and availability reminders