-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent back-to-back combo breaking in the counting game #808
base: main
Are you sure you want to change the base?
Conversation
…us1/TripBot into counting-offender-fix
I like the general idea here, but i don't like storing an object as a string in the database Instead, let's stretch those prisma legs, can you please make a new table for combo breakers? Something like: ` } model counting_breaks { user users @relation(fields: [user_id], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "counting_userid_foreign") @@unique([user_id, game_id], map: "counting_userid_gameid_unique") This way it's more extensible and 'proper': Maybe one day we'll want to get a list of how many times each person has broken the combo or something When you're done, you'll need to create a new migration file that will modify the database. In the package.json there's the 'db:migrateDev' npm script. You'll want to modify 'welcome_fix' to like 'counting_breakers' and then run the script Just to explain: We use a postgres database, and prisma is a layer between us and the database. We still use migration files to manage the database, but prisma makes it easy and lets us modify the schema file to be what we want it to be, and prisma takes care of generating the migration files for us, so we don't need to actually write (or debug) SQL Thank you! |
This PR should prevent the same user being able to break combos back to back, regardless of which counting game mode they originally broke the combo of.
UPDATE: This now should prevent the last 4 people to have broken the combo from breaking it again. It also fixes formatting issues in the warning before breaking a combo.
Fix #695.