Skip to content

Conversation

@jasonyess
Copy link
Contributor

In the Add demon form, passing a level ID would raise status code 500, since the level_id column in the new demons row needed to reference a row in the gj_level table, which it didn't

Now, it inserts the new row in the demons table without the level ID (regardless of if it was given or not), and uses GeometryDashConnector's refresh_demon_data function to add a new row to gj_level, and a valid level_id column to the new demons row

License Acceptance

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov
Copy link

codecov bot commented Dec 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 29.61%. Comparing base (1d3aeac) to head (0201214).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
pointercrate-demonlist-pages/src/account/demons.rs 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@stadust
Copy link
Owner

stadust commented Dec 29, 2024

... 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

Copy link
Owner

@stadust stadust left a 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.

@jasonyess jasonyess requested a review from stadust December 30, 2024 01:01
@stadust
Copy link
Owner

stadust commented Dec 30, 2024

Thanks!

@stadust stadust merged commit af8d233 into stadust:master Dec 30, 2024
3 of 4 checks passed
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