Skip to content

refactor(schedule): extract shared pure schedule filter#198

Open
chiptus wants to merge 1 commit into
mainfrom
claude/188-190-shared-schedule-filter
Open

refactor(schedule): extract shared pure schedule filter#198
chiptus wants to merge 1 commit into
mainfrom
claude/188-190-shared-schedule-filter

Conversation

@chiptus

@chiptus chiptus commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Extracts the duplicated day/time-of-day/stage filter predicates from Timeline and ListSchedule into one pure filterScheduleDays function in src/lib/scheduleFilter.ts, so upcoming vote-type filtering (parent PRD #188) can be added in a single place.
No behavior change; also removes a stray debug console.log from ListSchedule.

Closes #190

Verification

  • Unit tests: pnpm vitest run src/lib/scheduleFilter.test.ts covers day, festival-timezone time-of-day, and stage predicates plus combinations, without rendering the DOM.
  • pnpm run lint, pnpm run typecheck, and pnpm vitest run (full suite, 364 tests) all pass.
  • Manually: open the Schedule tab in both Timeline and List views, apply day/time/stage filters via the URL controls, and confirm the same sets are visible in both views as before this change.
  • e2e runs in CI (no local Supabase available in this environment; no new e2e spec needed for a no-behavior-change prefactor).

Generated by Claude Code

Timeline and ListSchedule each had their own inline day/time/stage
filter predicates. Extract filterScheduleDays into src/lib/scheduleFilter.ts
so both views share one pure, unit-tested implementation, and remove
a stray debug console.log from ListSchedule in the process.

Closes #190

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AziTqr3f12fxALYD6jhrW8
Copilot AI review requested due to automatic review settings July 14, 2026 18:19
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
upline Ready Ready Preview, Comment Jul 14, 2026 6:20pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors duplicated schedule filtering logic (day, time-of-day in festival timezone, and stage selection) out of the Timeline and List Schedule views into a shared pure helper (filterScheduleDays) in src/lib/scheduleFilter.ts, with unit tests to lock behavior and enable upcoming vote-type filtering work.

Changes:

  • Extracted shared filter predicates into filterScheduleDays(scheduleDays, criteria, timezone).
  • Updated Timeline and ListSchedule to use the shared filter helper (and removed the stray debug console.log in ListSchedule).
  • Added dedicated unit tests covering day/time/stage predicates and combinations.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/pages/EditionView/tabs/ScheduleTab/list/ListSchedule.tsx Replaces inline filtering with filterScheduleDays and removes debug logging.
src/pages/EditionView/tabs/ScheduleTab/horizontal/Timeline.tsx Replaces inline filtering with the shared filterScheduleDays helper.
src/lib/scheduleFilter.ts Introduces the pure shared filter function and criteria type (timezone-aware time buckets).
src/lib/scheduleFilter.test.ts Adds unit tests validating day/time/stage filtering behavior and non-mutation.

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.

prefactor: one pure schedule-filter function behind both Schedule views

3 participants