Skip to content

feat(web): make an Event repeat from the create dialog and mark repeating Events in the list - #231

Open
mwg-bender[bot] wants to merge 1 commit into
devfrom
feat/100-repeat-section
Open

mwg-bender[bot] wants to merge 1 commit into
devfrom
feat/100-repeat-section

Conversation

@mwg-bender

@mwg-bender mwg-bender Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Web part 1 of the recurring Events spec (#204, covers #100). The create Event dialog gets a Repeat section. Creating with Repeat on sends one POST api/series and no Event; the Series makes its Occurrences itself. The Events list marks every Occurrence with a "Repeats" icon. Every Web reader of an Event's Selections was checked with an Occurrence that has none; all already coped, and new tests pin it.

Change

  • Services/SeriesService.cs (new, scoped, registered in AppServices): CreateAsync(SeriesEntity, Guid idempotencyKey), i.e. POST api/series with the Idempotency-Key header, sent the way EventService.SaveAsync sends it.
  • Shared/Events/RepeatChoice.cs (new, pure: no clock, no JS, no services): the admin's choices in, the RecurrenceSeries (First, Rule, End) out.
    • It holds the rules offered in the spec's words, the weeks First to Fourth and Last, the weekdays, and one table of readable holiday names.
    • The week, weekday and holiday default from the picked date: the 8th to 14th is Second, the 29th to 31st is Last, and the holiday falling on that date is picked.
    • The end is the end date at the start's time and UTC offset.
    • EndProblem gives the API's own End must be after the start.
  • Shared/Events/RepeatSection.razor (new):
    • the Repeat switch and the hint line;
    • the Repeats select;
    • Week of the month and Weekday, shown only for Monthly on the nth weekday;
    • Holiday, shown only for Yearly on a holiday;
    • Ends on (optional).
  • Shared/Events/EventEditDialog.razor (315 → 353 lines):
    • hosts the section in create mode only, resetting it with every opening;
    • builds the Series: the start exactly as BuildEventDate() makes it (offset kept), the dialog's slot count, Unique games only, and Filters { ThemedOnly, GameIds, ThemeIds, HolidayIds };
    • keeps _createKey;
    • disables Create while the end is not after the start;
    • shares one save routine (SendAsync) between the Event save and the Series save, so a success closes the dialog and reloads the list, and a failure shows the API's message in the dialog's role="alert".
  • Shared/Events/EventList.razor: the Name column became a TemplateColumn with the marker. Its sort is still by name, and the grid template is unchanged.
  • Tests: RepeatChoiceTests, RepeatSectionDialogTests and EmptyOccurrenceTests are new. ServiceRouteContractTests gets the SeriesService row and a key-header test. PageHarness registers SeriesService, and StubApiHandler records Idempotency-Key.

No API, Shared, Api.Tests, docs or .github file is touched.

Validation

All numbers are from the worker's own cold builds (clean-build.sh, then build --no-incremental, then test --no-build).

Baseline b4d825e After f3700f3
Build 0 errors, 0 warnings 0 errors, 0 warnings (no new warning code)
Api.Tests 870 passed + 4 skipped 870 passed + 4 skipped
Web.Tests 1007 1064 (0 failed)
E2E 5 passed + 12 skipped (17) 5 passed + 12 skipped (17)

Web +57: RepeatChoiceTests 29, RepeatSectionDialogTests 22, EmptyOccurrenceTests 5, ServiceRouteContractTests +1. No test was removed or renamed.

Mutations: 17 run, all killed, each by the test it names (wrong rule kind; nth week and nth weekday off by one; Last sent as Fourth; End dropped; offset lost to UTC; SlotCount fixed; Filters not sent; both an Event and a Series sent; key regenerated on retry; section shown in Edit; Repeat not reset; marker inverted and marker on every Event; the empty guard removed in the details dialog, in PlayStats and in the announcement; Create not disabled). The list is in the evidence file on the card.

Live flows were run by the worker under with-slot.sh (debug API, published Release web behind SWA, headless Chromium, browser zone America/Chicago). Dates were typed and Enter pressed, because the calendar popup does not open headless.

Flow Branch Control origin/dev
F1 Create dialog shows Repeat off PASS (*) FAIL (no Repeat switch: expected)
F2 weekly Series: 7 Occurrences, each marked, 0, None PASS ERROR (no section: expected)
F3a monthly 2nd Thursday: API 2026-12-11T01:00:00Z, 2027-01-15T01:00:00Z; list 12/10/2026 and 1/14/2027 7:00 PM PASS ERROR (expected)
F3b Thanksgiving: API 2026-11-27T00:00:00Z; list 11/26/2026 6:00 PM PASS ERROR (expected)
F4 end 12/17: 3 Occurrences, the last 12/17 PASS ERROR (expected)
F5 empty Occurrence details, clipboard read back: "The picks are still to come." PASS PASS
F6 Edit of an empty Occurrence opens, no Repeat section PASS PASS
F7 Stats and Activities pages load with Occurrences PASS PASS
F8 standalone create, Repeat off: 1 Event, no marker, no Series PASS PASS
F9 API refusal of an end before the start (request rewritten in the browser): alert "The event was not saved. End must be after the start." PASS ERROR (expected)

F2 to F9 on the branch ran on the same content as f3700f3, uncommitted at the time. (*) In that run F1 reported FAIL current-checked=false, a script bug: a real <fluent-switch> writes current-checked="false" while off. With the check corrected to read the element's checked, F1 was re-run on a detached checkout of f3700f3: PASS current-checked=false checked=false selects=0. Every run also passed the 10 baseline api_flows.py checks.

Not run: the screen-reader and keyboard pass in a real browser. The accessible names and Tab order are checked in bUnit only (EveryRepeatControl_HasItsAccessibleName_AndIsInTheTabOrder).

Notes

Refs #100, #204: Nerd closes the issues by hand. Out-of-scope findings and the audit table are in the PR comment.

…ting Events in the list

The create Event dialog gets a Repeat section (off with every opening, never
shown in Edit): Weekly, Every other week, Monthly on the nth weekday (First to
Fourth or Last, and the weekday), Monthly on the same date, Yearly on the same
date and Yearly on a holiday (the HolidayPreset list by readable name), plus
an optional end date. The week, weekday and holiday default from the picked
date until the admin picks one. An end that is not after the start shows the
API's own "End must be after the start." and disables Create.

Create with Repeat on sends one POST api/series (new SeriesService, same
Idempotency-Key handling as the Event create, the key kept across ambiguous
failures) and no Event: Name, Schedule { First exactly as BuildEventDate makes
it with the browser's offset kept, Rule, End at the start's time and offset },
the dialog's slot count, Unique games only and the Filters. The roll shown is
not saved; a hint under the switch says so. Success closes the dialog and
reloads the list; a refusal shows the API's message in the dialog's alert.

The Events list marks every Occurrence (SeriesId set) with a "Repeats" icon
beside its name, inside the Name column, so the grid template is unchanged.
The pure model is RepeatChoice; the section is RepeatSection.

Every Web reader of Selections was checked with an empty Occurrence; all
already coped, and new tests pin it.

Refs #100, #204
@mwg-bender

mwg-bender Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Worker notes (t_176130e2): disposition, audit, observations

DISPOSITION

  • #204 Web: Repeat section DONE: in the create Event dialog only, placed right under the name/date/time row and above the Filters and slots. A card with the Repeat switch, then the rule select Repeats (Weekly first), Week of the month + Weekday (Monthly on the nth weekday only), Holiday (Yearly on a holiday only), and Ends on (optional).
  • #204 Web: "roll is not saved" hint DONE: one line under the switch while Repeat is on: "Each repeat starts with no picks yet: the activities rolled below are not saved." Pinned in RepeatSectionDialogTests.Repeat_IsOffWhenTheDialogOpens_AndOffAgainAfterReopening.
  • #204 Web: repeat marker DONE: a Size16.ArrowRepeatAll icon in the accent colour, inside the Name cell before the name, wrapped in <span class="repeat-marker" role="img" aria-label="Repeats" title="Repeats">. The grid template is unchanged (still 5 columns, pinned in a test). The Name column became a TemplateColumn with SortBy = Name, so sorting is the same as before.
  • #204 Web: end date DONE: an end not after the start shows the API's own End must be after the start. under the box and disables Create. The end is sent at the start's time of day and offset.
  • #204 Web: one POST api/series, no Event DONE: SeriesService.CreateAsync, Idempotency-Key sent as EventService.SaveAsync sends it, and _createKey kept across failures (same key on a retry).
  • #204 Web: empty-Occurrence audit DONE: see below; nothing needed a fix.
  • #204 Web: scope dialog, rolling an empty Occurrence from the Series template OUTSIDE: next card.
  • #100 DONE for the Web part 1 slice; the issue stays open (Nerd closes it).

Behaviour decision to flag: the Repeat choices count as unsaved changes (they are in the dialog's CustomizeFields), so turning Repeat on and pressing Escape asks "Discard changes?", like every other input (#91).

Audit: every Web file that reads an Event's Selections (grep), with an Occurrence that has none

File Result
Shared/Events/EventList.razor (Selections count, Winner column) copes already: shows 0 and None. Test EmptyOccurrenceTests.TheList_MarksTheOccurrenceOnly_AndShowsZeroSelectionsAndNoWinner; live F2
Shared/Events/EventDetailsDialog.razor (single-Selection line, cards, Select Winner) copes already: no cards, no Select Winner, no error. Test Details_OfAnEmptyOccurrence_OpensWithoutError_AndOffersNoWinner; live F5
Shared/Events/AnnouncementText.cs (Copy announcement) copes already (#227): "The picks are still to come." Tests AnnouncementCopyTests.AnEventWithNoSelections_CopiesThatThePicksAreStillToCome, AnnouncementTextTests.NoSelections_SaysThePicksAreStillToCome; live F5 read the clipboard back
Shared/Events/EventEditDialog.razor (opening an Occurrence for Edit) copes already: opens with no slots, no error, no Repeat section. Test Edit_OfAnEmptyOccurrence_OpensWithoutError; live F6
Select Winner copes already: there is no Selection, so no button (same test as the details dialog)
Services/PlayStats.cs (Stats page, Activity performance panel, Play stats) copes already: an empty Occurrence offers nothing; no Offered, wins or Likes counted, and the win rate stays null (no division by zero). Tests PlayStats_CountsNothingForAnEmptyOccurrence, TheStatsPage_RendersWithAnEmptyOccurrence (no "NaN"); live F7a, F7b
Services/RecentActivities.cs (avoid recent) copes already: Selections is { Count: > 0 } filter from #221. Not re-tested here
Shared/Activities/CommentsPanel.razor, ActivityPerformancePanel.razor read the Events list only for names, or through PlayStats; covered above
Shared/Events/SlotPanel.razor, Services/SlotPlanner.cs, EventMetricsForm.razor, PerformanceFormat.cs the word only (slot counts, messages, comments); they do not read an Event's Selections

Observations for Nerd (not fixed)

  1. API/Shared gap (STOP item, not fixed): SeriesFilters has no avoid recent, players tonight or longest duration, but the spec and ADR 0002 put them in the Series' slot template. The dialog does not send them. A Series made with those Filters on loses them silently.
  2. A repeating create still rolls the dialog's slots, which are thrown away. The hint says so. Hiding or greying the slots while Repeat is on is a layout opinion.
  3. The failure prefix is still "The event was not saved." for a Series. "The repeating event was not saved." might read better; I kept the shared helper as the card asked.
  4. Editing an empty Occurrence and pressing Update Event shows "Select 1–5 activities before saving…": rolling it belongs to the next card.
  5. When the picked date is not a holiday, the Holiday select defaults to New Year's Day (the first row of the table).
  6. Test harness: bUnit leaves current-checked off a switch that is off, but a real <fluent-switch> writes current-checked="false". My first F1 script misread that as on; the corrected flow reads the element's checked.

For the docs card

  • GLOSSARY: Series and Occurrence are no longer "planned": an admin makes a Series from the create Event dialog's Repeat section. Name the rules in the dialog's words and the holiday presets by readable name. An Occurrence carries the "Repeats" marker in the Events list, and with no Selections it shows 0 and None.
  • GLOSSARY, Filters: a Series keeps Game, Theme and Holiday Filters, Themed only and Unique games only, but not avoid recent, players tonight or longest duration (see observation 1, unless the API grows them first).
  • ADR 0002, Consequences: the Web readers of Selections were checked with an empty Occurrence (the list above).
  • docs/api-validation.md: no change; the Web uses POST /api/series as documented.

@github-actions

Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
1938 1934 0 0 4 0 56.8s

🎉 No failed tests in this run.

Github Test Reporter by CTRF 💚

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants