]> git.cworth.org Git - turbot/commit
Add find_puzzle_for_puzzle_id
authorCarl Worth <cworth@cworth.org>
Tue, 12 Jan 2021 01:53:36 +0000 (17:53 -0800)
committerCarl Worth <cworth@cworth.org>
Tue, 12 Jan 2021 02:02:18 +0000 (18:02 -0800)
commitd63943a1adccccda1ddf43e609701a0615577670
treedcbcec11491950800877c901ac58b3d888a1d5c9
parentd53959afec8688d3f3c164f1b94de6dbec8bc13c
Add find_puzzle_for_puzzle_id

This exists so that the puzzle-creation code can ensure that it's not
creating a puzzle with the same puzzle_id as an existing
puzzle. Previously, Turbot was just relying on Slack to guarantee
uniqueness, (which worked when channel names were just made from
hunt_id and puzzle_id).

But more recently, the channel names have round names in them as
well. This set up a possible collision where two puzzle with the same
puzzle_id could be created but with different channel names, (if the
two puzzles were placed in different rounds). To be able to fix this
bug we need this query to be able to find a puzzle by means of using
the puzzle_id.

This does require a new index on the database, so that's here too,
(and we're nuking our database to be able to roll this out).
turbot/interaction.py
turbot/puzzle.py