Fix wheel shot and prize stock handling#45
Merged
Conversation
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>
✅ Deploy Preview for kid-a ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.sourcecolumn 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.sqlis restored unchanged so already-applied migration checksums remain valid.0003_drop_prize_award_source.sqldrops the legacy source column and index.column "source" does not existon API cold starts.Validation:
npm run lint && npm run buildnpm run build:netlifyLocal repro notes:
previous 3 / remaining 0after reload and Spin is disabled.