From 355aacfe12c2037e02c90d3777f206dc8292521d Mon Sep 17 00:00:00 2001 From: moveson Date: Thu, 19 Dec 2024 22:24:44 -0700 Subject: [PATCH] Set withdrawn status first before looking at rank --- db/schema.rb | 2 +- db/views/lotteries_division_rankings_v02.sql | 2 +- erd.pdf | Bin 77448 -> 77448 bytes 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index 54e436acf..7e951d623 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 diff --git a/db/views/lotteries_division_rankings_v02.sql b/db/views/lotteries_division_rankings_v02.sql index ad64bb571..203d5d89e 100644 --- a/db/views/lotteries_division_rankings_v02.sql +++ b/db/views/lotteries_division_rankings_v02.sql @@ -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 diff --git a/erd.pdf b/erd.pdf index fc4daf30cc1fde19189cafa49497f5d22398ed4d..bc193aed0bb3c8a7ab29e3d56c824998723d0522 100644 GIT binary patch delta 286 zcmV+(0pb3L-2{l;1c0;wxGR6!huV_-lO~uPVnZmUV3OWS4?-4>p;$(eOY`=X>^P+e z7WQLDGs{wtpvaMvfPv;TC<>&TA}C8F@7GZxX?Q1103dnoTZ0cU5S;Kiqe@MK1r7H5 zSlx z!hY;%W?2dnl?4hCG0=iWWr?gRqq;`=eitFv>X-K6PEd&9@G5;oDMkK^k%Mslb0&~Sezv1&Gqu$(fw zrd3uJ`4g!g35gezzgT$i)dO*)a9&`M-xUX= zrxA4>n$TZeX1bu0r-l!93~u7G;1@VE$)(%-sYZS)A=|?)K%YABR$4t7AuY1I=gA9& kyN0*^4*wS1bH~4Qf7=Yt-{7{MANmCk25(fi!Yl#C0R+vBrvLx|