Skip to content

fix: bugs with changing pet variants#278

Merged
ScuffedNewt merged 6 commits intoScuffedNewt:extension/petsfrom
perappu:extension-pr/pets
Mar 12, 2026
Merged

fix: bugs with changing pet variants#278
ScuffedNewt merged 6 commits intoScuffedNewt:extension/petsfrom
perappu:extension-pr/pets

Conversation

@perappu
Copy link
Copy Markdown

@perappu perappu commented Mar 9, 2026

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_id on its related PetDrop falls out of sync. This can cause a variety of rather insidious and vague errors (usually something to do with a null value when looking for drops_available), especially when trying to mass collect drops. This fix ensures it stays in sync with its new pet_id.

I have included a console command php artisan fix-pet-drop-ids which will fix existing inconsistent PetDrops. I also included fixes to the debitStack and editVariant functions that will prevent the creation of orphaned rows in the pet_drops table (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:

image image

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!

@ScuffedNewt ScuffedNewt merged commit b8efbf5 into ScuffedNewt:extension/pets Mar 12, 2026
2 of 3 checks passed
@perappu perappu deleted the extension-pr/pets branch March 15, 2026 20:39
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.

2 participants