#32 Settings Per Cycle#37
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
|
@copilot cycle management is a separate ticket, remove from this |
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
| isReadOnly = !cycle.isActive; | ||
| settings = await getSettingsByCycleId(cycleId); | ||
| if (!settings) { | ||
| // Inactive cycle with no settings - redirect back to avoid confusion |
There was a problem hiding this comment.
There should be an error instead, all cycles should have settings
There was a problem hiding this comment.
Fixed in e55fb1d — now throws Error("Settings not found for cycle ${cycleId}. All cycles should have a settings record.") instead of redirecting.
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
|
@copilot just updated the branch, integrate the cycles management page into this |
…tings Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
Done in d47f2e3. Added |
|
@copilot thats a separate ticket, just make sure the settings page only uses the active cycle |
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
b-at-neu
left a comment
There was a problem hiding this comment.
can you check in the updating of settings that only an active setting is being updated?
Co-authored-by: b-at-neu <144247685+b-at-neu@users.noreply.github.com>
Done in 873758e. Two changes to
|
b-at-neu
left a comment
There was a problem hiding this comment.
can you check in the updating of settings that only an active setting is being updated?
Ensures settings are properly scoped to cycles, with the settings page always reflecting the active cycle's configuration and writes guarded to only affect the active cycle.
Changes Made
lib/data/cycles.ts— AddedgetCycleByIdhelper for direct cycle lookup by IDlib/data/settings.ts— AddedgetSettingsByCycleIdfor fetching settings for any specific cycleapp/admin/settings/page.tsx— Settings page uses the active cycle only viagetSettings()app/admin/settings/settings-form.tsx— AddedisReadOnlyprop: renders a yellow banner ("This is an inactive cycle. Settings cannot be modified."), disables all inputs, and hides the Save button when viewing an inactive cycle's settingslib/actions/settings.ts— Added explicitisActiveguard before any DB write; replacedupsertwithupdateso settings can only be updated (never created) through this action — creation is handled bycreateCycle/setActiveCycle, ensuring only active cycle settings are ever modifiedOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.