-
Notifications
You must be signed in to change notification settings - Fork 86
Fix code 500 when adding a demon with level ID
#203
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #203 +/- ##
==========================================
+ Coverage 29.57% 29.61% +0.03%
==========================================
Files 116 116
Lines 8314 8314
==========================================
+ Hits 2459 2462 +3
+ Misses 5855 5852 -3 ☔ View full report in Codecov by Sentry. |
|
... how did nobody ever notice this?? Did we just straight up not add any demons since September or something? lmao Edit: wow, yeah, according to the discord changelog that is indeed the case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reporting this!
However, I think the better solution is to drop the foreign key constraint from the demons table. The approach implemented here would mean that the explicitly specified ID is ignored (and will also not work if the pointercrate instance is IP-banned by RobTop). I don't think the foreign key constraint is needed for anything (at least at a glance at the gd connector code, I can't see anything that needs it).
Removing the required on the HTML form we can still do though, in case someone wants to make use of the auto-resolution (which, if the pointercrate instance isn't IP banned would overwrite the manually specified ID every 24 hours anyway... that should probably change so that the name->ID resolution is only tried if Demon::level_id is None, but that's also out of scope for this PR).
While you're at it, can you add a regression test? Something as simple as adding a dummy level_id parameter to the request body in test_add_demon_ratelimits should do the trick.
|
Thanks! |
In the Add demon form, passing a level ID would raise status code
500, since thelevel_idcolumn in the newdemonsrow needed to reference a row in thegj_leveltable, which it didn'tNow, it inserts the new row in the
demonstable without the level ID (regardless of if it was given or not), and usesGeometryDashConnector'srefresh_demon_datafunction to add a new row togj_level, and a validlevel_idcolumn to the newdemonsrowLicense Acceptance
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.