fix: bugs with changing pet variants#278
Merged
ScuffedNewt merged 6 commits intoScuffedNewt:extension/petsfrom Mar 12, 2026
Merged
fix: bugs with changing pet variants#278ScuffedNewt merged 6 commits intoScuffedNewt:extension/petsfrom
ScuffedNewt merged 6 commits intoScuffedNewt:extension/petsfrom
Conversation
…eper into extension-pr/pets
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.
Fixes a few bugs with changing pet variants (and adds a little bit of consistency polish while I was already there).
When changing a pet's variant, the
drop_idon its relatedPetDropfalls out of sync. This can cause a variety of rather insidious and vague errors (usually something to do with a null value when looking fordrops_available), especially when trying to mass collect drops. This fix ensures it stays in sync with its newpet_id.I have included a console command
php artisan fix-pet-drop-idswhich will fix existing inconsistent PetDrops. I also included fixes to thedebitStackandeditVariantfunctions that will prevent the creation of orphaned rows in thepet_dropstable (the command will also delete any existing orphaned rows). It's been thoroughly tested on both my local and two separate live sites, so I'm pretty sure it doesn't accidentally explode anything critical.This PR also includes a fix for when trying to set a pet back to its "default", since it wasn't yet updated for the pet parent_id change.
A warning is now also displayed to both users and staff when you're about to change the variant on a pet that has pending drops to collect:
Let me know if you want me to just disable users from being able to change variants entirely when there's pending drops, might make it a little more oh-no-I-didn't-read-regret-proof. :P
Thanks again!