Add missing submissions filter for broadcast audience targeting#415
Add missing submissions filter for broadcast audience targeting#415zacjones93 wants to merge 2 commits intomainfrom
Conversation
Organizers running online competitions can now target athletes who haven't submitted scores for every event required of a division, without bothering those who have already submitted everything. Honors event-division mappings when scoping required events. Pending-invite teammates are always kept since they have no user account to check submissions against. Applied after question filters so team-inheritance in applyAthleteQuestionFilters still has the captain row available to resolve teammate matches. Recipient-level dedup already handles athletes registered in multiple divisions (same userId collapses to one row).
…d false scoresTable.competitionEventId stores the trackWorkoutId (not competitionEventsTable.id) — every insert site writes data.trackWorkoutId to that column. The submission-window notifier was passing event.id into hasUserSubmittedScore, which meant the score lookup never matched and every athlete was shown the "Missed Submission" subject and body even when they had submitted on time. Rename the helper's parameter to trackWorkoutId to make the semantic explicit, pass event.trackWorkoutId at the call site, and document the scores column's historical naming so this doesn't bite us again.
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 14 minutes and 24 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
1 issue found across 6 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="apps/wodsmith-start/src/server-fns/broadcast-fns.ts">
<violation number="1" location="apps/wodsmith-start/src/server-fns/broadcast-fns.ts:675">
P1: Missing-submissions division filtering ignores parent-event mapping inheritance, so recipients can be incorrectly flagged as missing scores.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| ) | ||
|
|
||
| return events | ||
| .filter((e) => |
There was a problem hiding this comment.
P1: Missing-submissions division filtering ignores parent-event mapping inheritance, so recipients can be incorrectly flagged as missing scores.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/wodsmith-start/src/server-fns/broadcast-fns.ts, line 675:
<comment>Missing-submissions division filtering ignores parent-event mapping inheritance, so recipients can be incorrectly flagged as missing scores.</comment>
<file context>
@@ -614,6 +626,125 @@ async function partitionQuestionFilters(
+ )
+
+ return events
+ .filter((e) =>
+ !mappedEventIds.has(e.trackWorkoutId)
+ ? true
</file context>
Summary
Adds a new "missing submissions" audience filter type to the broadcast system, allowing organizers to target athletes in a specific division who haven't submitted scores for all required events. This is useful for sending reminder notifications before submission windows close.
Key Changes
missing_submissionstoaudienceFilterTypewith requireddivisionIdparametergetDivisionRequiredTrackWorkoutIds()to determine which events are required for a division, respecting event-division mappings (unmapped events apply to all divisions; mapped events only apply to their specified divisions)applyMissingSubmissionsFilter()to identify athletes missing submissions by batch-loading their scores and comparing against required eventssendBroadcastFnandpreviewAudienceFnto preserve team inheritance logic (captains must remain in the pool for teammates to inherit their registration answers)pending_teammatesfilterscoresTable.competitionEventIdstorestrackWorkoutId(notcompetitionEventsTable.id) with comments in both broadcast-fns.ts and submission-window.ts to prevent future bugsNotable Implementation Details
https://claude.ai/code/session_01EGo1FxXpNr8M2jRR7RHfjT
Summary by cubic
Add a new “missing submissions” audience filter so organizers can target athletes in a division who haven’t submitted all required events. Also fixes a notification bug that mis-reported missed submissions.
New Features
missing_submissionsfilter (requiresdivisionId); resolves required events using division mappings (unmapped = all divisions; mapped = only those divisions).Bug Fixes
trackWorkoutId(the value stored inscoresTable.competitionEventId), notcompetitionEventsTable.id.Written for commit 8c490e8. Summary will update on new commits.