pwncollege / dojo

Infrastructure powering the pwn.college dojo
https://pwn.college
BSD 2-Clause "Simplified" License
281 stars 90 forks source link

Navbar flag input keys off of challenge id instead of challenge index #544

Open sjzhu opened 3 weeks ago

sjzhu commented 3 weeks ago

What?

The navbar flag input's previous and next buttons can sometimes show the wrong challenge if the current challenge was created recently, but shows up earlier in the challenge listing:

image

The line in question appears to be this one: https://github.com/pwncollege/dojo/blob/master/dojo_plugin/utils/dojo.py#L504 It probably should be using this: https://github.com/pwncollege/dojo/blob/master/dojo_plugin/models/__init__.py#L437

cc @ConnorNelson

JensHouses commented 2 weeks ago

I'll Fix it. But this also means my tests are useless 🤣 sorry mate

sjzhu commented 2 weeks ago

Haha! I was just working on this myself! I'll let the expert handle it though!

sjzhu commented 1 week ago

Sorry, I lied! 😅 While learning how the dojo worked, I also saw a way I could reduce the number of queries sent to the DB, so I took a stab at it too!