fix: config path uses dynamic practices from practice_schedules table #53
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "52-config-path-use-dynamic-practices"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Config-driven contracts used
data.config.practices(fromteams.contract_configJSONB) instead of the dynamicpractice_schedulestable query. Now both paths use the same source of truth.Changes
data.config.practicesin Practice Schedule rendering with{#each practices}dynamic loopdata.config.practicesin fee description practice count withpracticesarrayTest Plan
practice_schedulestablepractice_schedulestableReview Checklist
npm run build)config.practicesremain in templateRelated Notes
story:WS-S28— parent sees correct practice schedulePR #53 Review
DOMAIN REVIEW
Stack: SvelteKit / TypeScript / CSS (westside-contracts)
This PR replaces
data.config.practices(static JSONB config) with the dynamicpracticesarray (frompractice_schedulestable) in the data-driven contract rendering path. One file changed, 11 additions, 2 deletions. Scope is tight and matches issue #52.Semantic shift --
p.optionaltop.notes: The old code used an explicitp.optionalboolean to distinguish required vs. optional practices. The new code usesp.notesas a proxy: practices with notes are treated as optional, practices without notes are treated as required. This drives two behaviors:practices.filter(p => !p.notes).lengthcounts "required" practicespractices.some(p => p.notes)triggers "plus optional sessions"If any practice has notes that are NOT about optionality (e.g., "Bring shin guards"), it will be miscounted as optional. Verify that the
practice_schedules.notescolumn is used exclusively for optional indicators in the current data. If it is general-purpose, this needs a dedicatedis_optionalcolumn or explicit filter.Inline rendering replaces PracticeSchedule component: The
<PracticeSchedule>component is replaced with an inline{#each}block. The generated HTML uses the same CSS classes (schedule-row,schedule-day,schedule-detail,schedule-optional) that exist inapp.cssand match the hardcoded fallback paths. Structurally correct.Fallback: Good -- empty practices array shows "Practice schedule will be communicated by your coach." rather than an empty section.
Accessibility: The schedule rows use
<div>+<span>without semantic table markup or ARIA roles. This matches the existing pattern in the fallback paths, so not a regression. Non-blocking.BLOCKERS
None. The
notes-as-optional-proxy is a correctness concern but not a security or data integrity blocker -- it depends on how the column is actually used in the database. Ifnotesis only ever "optional" or null, the logic is correct.NITS
Repeated filter expression:
practices.filter(p => !p.notes).lengthappears twice in theFeeSectionpracticeDescription string (once for the count, once for the plural suffix). Consider extracting to aconst requiredCountvariable for clarity and DRY.PracticeSchedule component orphan: If the
<PracticeSchedule>component is no longer used anywhere after this change, it should be removed in a follow-up to avoid dead code.Hardcoded fallback paths still exist: Lines 323-333, 490-500, 589-596 still have hardcoded schedule rows in the non-config rendering paths. The PR body says "Zero references to
config.practicesremain" which is true, but the broader goal of dynamic schedules everywhere is incomplete. Not in scope for this PR (tracked by #49/#50/#51), but worth noting.SOP COMPLIANCE
52-config-path-use-dynamic-practicesstory:WS-S28) and prior PRsPROCESS OBSERVATIONS
This is the third PR in a series (#50, #51, #53) migrating from hardcoded/config practices to DB-driven practices. The incremental approach keeps each PR small and reviewable. The test plan is manual (load contract, verify schedule source) which is appropriate for template rendering changes. The repo has 12 tests covering validation logic but no component/rendering tests -- this is a known gap, not introduced by this PR.
VERDICT: APPROVED