diff --git a/apps/wodsmith-start/src/db/schemas/scores.ts b/apps/wodsmith-start/src/db/schemas/scores.ts index 5741a7045..7a8a1d5da 100644 --- a/apps/wodsmith-start/src/db/schemas/scores.ts +++ b/apps/wodsmith-start/src/db/schemas/scores.ts @@ -51,7 +51,10 @@ export const scoresTable = mysqlTable( // What was scored workoutId: varchar({ length: 255 }).notNull(), - competitionEventId: varchar({ length: 255 }), // NULL for personal logs + // References trackWorkoutsTable.id (NOT competitionEventsTable.id) despite + // the name. The column predates the event/workout split; all insert sites + // write the trackWorkoutId here. NULL for personal logs. + competitionEventId: varchar({ length: 255 }), scheduledWorkoutInstanceId: varchar({ length: 255 }), // Score classification diff --git a/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/broadcasts.tsx b/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/broadcasts.tsx index b0e39548e..0b65e1f10 100644 --- a/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/broadcasts.tsx +++ b/apps/wodsmith-start/src/routes/compete/organizer/$competitionId/broadcasts.tsx @@ -190,6 +190,7 @@ type AudienceFilterType = | "volunteers" | "volunteer_role" | "pending_teammates" + | "missing_submissions" const VOLUNTEER_ROLES = [ { value: "judge", label: "Judge" }, @@ -236,7 +237,10 @@ function ComposeCard({ // Determine which questions to show based on audience type const relevantQuestions = useMemo(() => { - const isAthleteAudience = filterType === "all" || filterType === "division" + const isAthleteAudience = + filterType === "all" || + filterType === "division" || + filterType === "missing_submissions" const isVolunteerAudience = filterType === "volunteers" || filterType === "volunteer_role" const isPublic = filterType === "public" @@ -261,9 +265,11 @@ function ComposeCard({ divisionId, } : { type: "pending_teammates" as const } - : { - type: filterType as "all" | "public" | "volunteers", - } + : filterType === "missing_submissions" && divisionId + ? { type: "missing_submissions" as const, divisionId } + : { + type: filterType as "all" | "public" | "volunteers", + } if (questionFilters.length > 0) { return { ...base, questionFilters } @@ -274,7 +280,8 @@ function ComposeCard({ // Auto-fetch recipient count when filter is complete const filterReady = (filterType !== "division" || !!divisionId) && - (filterType !== "volunteer_role" || !!volunteerRole) + (filterType !== "volunteer_role" || !!volunteerRole) && + (filterType !== "missing_submissions" || !!divisionId) // Debounce the preview call const debounceRef = useRef | null>(null) @@ -340,6 +347,11 @@ function ComposeCard({ return } + if (filterType === "missing_submissions" && !divisionId) { + toast.error("Please select a division") + return + } + if (filterType === "volunteer_role" && !volunteerRole) { toast.error("Please select a volunteer role") return @@ -421,6 +433,9 @@ function ComposeCard({ Everyone (Public) All Athletes Athletes by Division + + Athletes Missing Submissions (by Division) + All Volunteers Volunteers by Role @@ -432,7 +447,8 @@ function ComposeCard({ {(filterType === "division" || - filterType === "pending_teammates") && ( + filterType === "pending_teammates" || + filterType === "missing_submissions") && (