If multiple swaps are requested in the frontend, it would be slow to call swapStaffRoleOrder over and over again for each swap, so instead, we'll rename this procedure swapStaffRoleOrders and accept multiple swaps in one single procedure call.
How?
As mentioned before, swapStaffRoleOrder will be renamed swapStaffRoleOrders. As for the implementation for this procedure, instead of the input being:
Since we're dealing with an array now, we need to filter out any redundant swaps (Example: Swap staff role 1 and 2, and then 2 and 1, that's redundant).
All checks already implemented in swapStaffRoleOrder must remain (error if tournament deleted or concluded, don't allow swapping defaults, etc.)
Why?
If multiple swaps are requested in the frontend, it would be slow to call
swapStaffRoleOrder
over and over again for each swap, so instead, we'll rename this procedureswapStaffRoleOrders
and accept multiple swaps in one single procedure call.How?
As mentioned before,
swapStaffRoleOrder
will be renamedswapStaffRoleOrders
. As for the implementation for this procedure, instead of the input being:Make it:
Since we're dealing with an array now, we need to filter out any redundant swaps (Example: Swap staff role 1 and 2, and then 2 and 1, that's redundant).
All checks already implemented in
swapStaffRoleOrder
must remain (error if tournament deleted or concluded, don't allow swapping defaults, etc.)