Skip to content

Fix wheel shot and prize stock handling#45

Merged
pablonete merged 5 commits into
mainfrom
pablonete-fix-wheel-remaining
Jun 27, 2026
Merged

Fix wheel shot and prize stock handling#45
pablonete merged 5 commits into
mainfrom
pablonete-fix-wheel-remaining

Conversation

@pablonete

@pablonete pablonete commented Jun 26, 2026

Copy link
Copy Markdown
Member

Wheel awards were recorded without reliably reducing the kid's remaining shots in remote mode, which allowed repeated spins after the first award. This changes shot accounting to derive used shots from awarded non-final prizes instead of a stored award source, removes the now-unused prize_awards.source column through a correctly numbered migration, and rejects remote wheel award requests when the kid has no shots left.

The stock dialog now appends a blank prize row when adding a prize. Saving a blank unawarded row removes it, while existing prizes with awards are preserved even if their title is cleared.

Database notes:

  • 0001_netlify_db.sql is restored unchanged so already-applied migration checksums remain valid.
  • 0003_drop_prize_award_source.sql drops the legacy source column and index.
  • DB bootstrap skips only the legacy source-based index statement if the source column has already been dropped, avoiding column "source" does not exist on API cold starts.

Validation:

  • npm run lint && npm run build
  • npm run build:netlify

Local repro notes:

  • Sample local mode does not reproduce the broken state: Gloria shows previous 3 / remaining 0 after reload and Spin is disabled.
  • The broken state is remote-specific because the remote page renders the persisted awards list separately from the remote shot summary. The client now reconciles those values, and the API enforces the shot limit as a backstop.

Ensure wheel prize awards consume available shots by deriving usage from non-final prize awards instead of a stored source column. Allow stock management to create blank prize rows and delete empty unawarded prizes when saved.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@netlify

netlify Bot commented Jun 26, 2026

Copy link
Copy Markdown

Deploy Preview for kid-a ready!

Name Link
🔨 Latest commit b1c21f9
🔍 Latest deploy log https://app.netlify.com/projects/kid-a/deploys/6a3e4dc9b7eb2a0008c4cab4
😎 Deploy Preview https://deploy-preview-45--kid-a.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

pablonete and others added 4 commits June 26, 2026 11:46
Merge remote shot summaries with persisted award counts so reloads cannot show previous awards with a zero used-shot counter. Reject remote wheel award requests when the kid has no shots left and refresh remote state if a save fails.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the prize_awards.source drop migration to 0003 so it no longer conflicts with the existing 0002 passport cleanup migration during Netlify Database migration validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the replayed Netlify DB bootstrap schema consistent with the later migration that drops prize_awards.source, so cold starts do not recreate source-dependent indexes after the column is gone.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore 0001_netlify_db.sql to its original contents and move the source-column compatibility handling into DB bootstrap, skipping only the legacy source-based index when the source column has already been dropped.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pablonete
pablonete merged commit 334823c into main Jun 27, 2026
5 checks passed
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.

1 participant