We'd like to be able to link otnames together, so that they always appear at the same time. This issue needs to be handled at the same time as the problem is solved on the site side, because both will rely on each other for proper testing. The site issue can be found at https://github.com/python-discord/site/issues/310.
For example, we may want the following names to always appear together:
#ot0-what-is-your-name?#ot1-what-is-your-quest?#ot2-what-is-your-favorite-color?
[ ] Create a command for linking otnames together, for example !otn link <first name> <second name> <optional third name>. Whenever this is called, all the involved otname objects in the database should be updated to contain the entire list of linked otnames, in the correct order.
[ ] Create a command for unlinking otnames, reversing the action from the other command. !otn unlink
[ ] When new otnames are drawn, let the following rules determine which names to use:
If none of the otnames have any linked_names, just add them normally.
If any of the otnames has two linked names (three names total), use these three as the otnames, and make sure to maintain the order. Discard any that remain. If more than one has two linked names, just pick one of the two at random.
If any of the otnames has one linked name (two names total), use these as the first two otnames, and use a single otname as the third name. If the two other otnames that were drawn both also have linked names, just draw new ones until you get one that doesn't. We don't wanna split up linked ones.
The basic idea is that, whenever we link names together, we will add all the names to all the otnames objects in this linked_names field. That way, no matter which one you get, you will have all the information you need without making additional queries.
We'd like to be able to link otnames together, so that they always appear at the same time. This issue needs to be handled at the same time as the problem is solved on the site side, because both will rely on each other for proper testing. The site issue can be found at https://github.com/python-discord/site/issues/310.
For example, we may want the following names to always appear together:
#ot0-what-is-your-name?
#ot1-what-is-your-quest?
#ot2-what-is-your-favorite-color?
!otn link <first name> <second name> <optional third name>
. Whenever this is called, all the involved otname objects in the database should be updated to contain the entire list of linked otnames, in the correct order.!otn unlink
The basic idea is that, whenever we link names together, we will add all the names to all the otnames objects in this
linked_names
field. That way, no matter which one you get, you will have all the information you need without making additional queries.