ggascoigne / amber

https://amberconnw.org
MIT License
3 stars 0 forks source link

game_choice contains extraneous 2023 choices for games not from 2023 #88

Closed evoskamp closed 1 year ago

evoskamp commented 1 year ago
  select 
    u.id as "userId", 
    g.id as "gameId", 
    m.id as "memberId", 
    u.full_name as "Full Name", 
    u.email as "Email",
    gc.year as "Year", 
    s.slot as "Slot", 
    gc.rank as "Choice", 
    g.name as "Game Title",
    g.gm_names as "GM Names",
    gc.returning_player as "Returning Player",
    gs.message as "Message"
  from game_choice gc 
    join game g on gc.game_id = g.id 
    join slot s on g.slot_id = s.id 
    join membership m on gc.member_id = m.id 
    join game_submission gs on m.id = gs.member_id and m.year = gs.year 
    join "user" u on m.user_id = u.id 
  where gc.year = 2023 AND g.id IN (SELECT g.id FROM "game" g WHERE g.year <> 2023) AND (g.id < 596 OR g.id > 603)
  order by u.id, gc.year, s.slot, gc.rank;

Shows all choices for games not in this year.

A spot check for one of them (Joe Saul) shows there is a valid choice for that slot/rank:

   select 
    u.id as "userId", 
    g.id as "gameId", 
    m.id as "memberId", 
    u.full_name as "Full Name", 
    u.email as "Email",
    gc.year as "Year", 
    s.slot as "Slot", 
    gc.rank as "Choice", 
    g.name as "Game Title",
    g.gm_names as "GM Names",
    gc.returning_player as "Returning Player",
    gs.message as "Message"
  from game_choice gc 
    join game g on gc.game_id = g.id 
    join slot s on g.slot_id = s.id 
    join membership m on gc.member_id = m.id 
    join game_submission gs on m.id = gs.member_id and m.year = gs.year 
    join "user" u on m.user_id = u.id 
  where gc.member_id = 573
  order by u.id, gc.year, s.slot, gc.rank;
evoskamp commented 1 year ago

Can't repro it anymore

ggascoigne commented 1 year ago

I'm going to close this since I'm pretty sure that it was caused by the queries not accounting for the differing ids for the acus "no game" and "any game" entries.

evoskamp commented 1 year ago

I'm going to close this since I'm pretty sure that it was caused by the queries not accounting for the differing ids for the acus "no game" and "any game" entries.

You are entirely right. I tried to repro it and tried to remember what I determined the cause for it was.