Skip to content

Commit

Permalink
Set withdrawn status first before looking at rank
Browse files Browse the repository at this point in the history
  • Loading branch information
moveson committed Dec 20, 2024
1 parent 944d3f0 commit 355aacf
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1052,9 +1052,9 @@
lottery_divisions.name AS division_name,
ranked_draws.division_rank,
CASE
WHEN lottery_entrants.withdrawn THEN 4
WHEN (ranked_draws.division_rank <= lottery_divisions.maximum_entries) THEN 0
WHEN (ranked_draws.division_rank <= (lottery_divisions.maximum_entries + lottery_divisions.maximum_wait_list)) THEN 1
WHEN lottery_entrants.withdrawn THEN 4
WHEN (ranked_draws.division_rank IS NOT NULL) THEN 2
ELSE 3
END AS draw_status
Expand Down
2 changes: 1 addition & 1 deletion db/views/lotteries_division_rankings_v02.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ select lottery_entrants.id as lottery_entrant_id,
-- not_drawn: 3
-- withdrawn: 4
case
when lottery_entrants.withdrawn then 4
when division_rank <= maximum_entries then 0
when division_rank <= maximum_entries + maximum_wait_list then 1
when lottery_entrants.withdrawn then 4
when division_rank is not null then 2
else 3 end as draw_status
from lottery_entrants
Expand Down
Binary file modified erd.pdf
Binary file not shown.

0 comments on commit 355aacf

Please sign in to comment.