Skip to content

Commit

Permalink
fix debug selectbox placeholder, contract freq order by
Browse files Browse the repository at this point in the history
  • Loading branch information
BSalita committed Feb 3, 2024
1 parent 3393dbf commit d58a8dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,9 @@ def player_number_change():
def debug_player_number_names_change():
# assign changed selectbox value (debug_player_number_names_selectbox). e.g. ['2663279','Robert Salita']
player_number_name = st.session_state.debug_player_number_names_selectbox
if not chat_initialize(player_number_name[0], None): # grab player number
chat_initialize(st.session_state.player_number, None)
#if not chat_initialize(player_number_name[0], None): # grab player number
# chat_initialize(st.session_state.player_number, None)
chat_initialize(player_number_name[0], None)


def club_session_id_change():
Expand Down Expand Up @@ -1149,7 +1150,8 @@ def create_sidebar():
st.session_state.debug_player_number_names = st.session_state.debug_favorites[
'SelectBoxes']['Player_Numbers']['options']
if len(st.session_state.debug_player_number_names):
st.selectbox("Debug Player List", options=st.session_state.debug_player_number_names, placeholder=st.session_state.debug_favorites['SelectBoxes']['Player_Numbers']['placeholder'],
# changed placeholder to player_number because when selectbox gets reset, possibly due to expander auto-collapsing, we don't want an unexpected value.
st.selectbox("Debug Player List", options=st.session_state.debug_player_number_names, placeholder=st.session_state.player_number, #.debug_favorites['SelectBoxes']['Player_Numbers']['placeholder'],
on_change=debug_player_number_names_change, key='debug_player_number_names_selectbox')

st.checkbox(
Expand Down
4 changes: 2 additions & 2 deletions default.favorites.json
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
"prompts": [
{
"prompt": "",
"sql": "SELECT Board, COUNT(Contract) AS Freq_Contract, Contract, ANY_VALUE(ParScore_{Pair_Direction}) AS ParScore_{Pair_Direction}, ANY_VALUE(ParScore_Pct_{Pair_Direction}) AS ParScore_Pct_{Pair_Direction}, ANY_VALUE(SDScore_{Pair_Direction}) AS SDScore_{Pair_Direction}, ANY_VALUE(SDPct_Max_Diff_{Pair_Direction}) AS SDPct_Max_Diff_{Pair_Direction}, ANY_VALUE(SDPct_{Pair_Direction}) AS SDPct_{Pair_Direction}, ANY_VALUE(DDTricks) AS DDTricks, ANY_VALUE(SDProbs_Taking_0) AS SDProbs_Taking_0, ANY_VALUE(SDProbs_Taking_1) AS SDProbs_Taking_1, ANY_VALUE(SDProbs_Taking_2) AS SDProbs_Taking_2, ANY_VALUE(SDProbs_Taking_3) AS SDProbs_Taking_3, ANY_VALUE(SDProbs_Taking_4) AS SDProbs_Taking_4, ANY_VALUE(SDProbs_Taking_5) AS SDProbs_Taking_5, ANY_VALUE(SDProbs_Taking_6) AS SDProbs_Taking_6, ANY_VALUE(SDProbs_Taking_7) AS SDProbs_Taking_7, ANY_VALUE(SDProbs_Taking_8) AS SDProbs_Taking_8, ANY_VALUE(SDProbs_Taking_9) AS SDProbs_Taking_9, ANY_VALUE(SDProbs_Taking_10) AS SDProbs_Taking_10, ANY_VALUE(SDProbs_Taking_11) AS SDProbs_Taking_11, ANY_VALUE(SDProbs_Taking_12) AS SDProbs_Taking_12, ANY_VALUE(SDProbs_Taking_13) AS SDProbs_Taking_13 FROM results GROUP BY Board, Contract"
"sql": "SELECT Board, COUNT(Contract) AS Freq_Contract, Contract, ANY_VALUE(ParScore_{Pair_Direction}) AS ParScore_{Pair_Direction}, ANY_VALUE(ParScore_Pct_{Pair_Direction}) AS ParScore_Pct_{Pair_Direction}, ANY_VALUE(SDScore_{Pair_Direction}) AS SDScore_{Pair_Direction}, ANY_VALUE(SDPct_Max_Diff_{Pair_Direction}) AS SDPct_Max_Diff_{Pair_Direction}, ANY_VALUE(SDPct_{Pair_Direction}) AS SDPct_{Pair_Direction}, ANY_VALUE(DDTricks) AS DDTricks, ANY_VALUE(SDProbs_Taking_0) AS SDProbs_Taking_0, ANY_VALUE(SDProbs_Taking_1) AS SDProbs_Taking_1, ANY_VALUE(SDProbs_Taking_2) AS SDProbs_Taking_2, ANY_VALUE(SDProbs_Taking_3) AS SDProbs_Taking_3, ANY_VALUE(SDProbs_Taking_4) AS SDProbs_Taking_4, ANY_VALUE(SDProbs_Taking_5) AS SDProbs_Taking_5, ANY_VALUE(SDProbs_Taking_6) AS SDProbs_Taking_6, ANY_VALUE(SDProbs_Taking_7) AS SDProbs_Taking_7, ANY_VALUE(SDProbs_Taking_8) AS SDProbs_Taking_8, ANY_VALUE(SDProbs_Taking_9) AS SDProbs_Taking_9, ANY_VALUE(SDProbs_Taking_10) AS SDProbs_Taking_10, ANY_VALUE(SDProbs_Taking_11) AS SDProbs_Taking_11, ANY_VALUE(SDProbs_Taking_12) AS SDProbs_Taking_12, ANY_VALUE(SDProbs_Taking_13) AS SDProbs_Taking_13 FROM results GROUP BY Board, Contract ORDER BY Board, Contract"
}
]
},
Expand Down Expand Up @@ -404,7 +404,7 @@
"prompts": [
{
"prompt": "",
"sql": "SELECT CASE WHEN Opponent_Pair_Direction='NS' THEN CONCAT(section_name, Pair_Number_NS, ' - ', Player_Name_N, ' - ', Player_Name_S) ELSE CONCAT(section_name, Pair_Number_EW, ' - ', Player_Name_E, ' - ', Player_Name_W) END AS Opponents, AVG(Pct_{Pair_Direction}) AS Avg_Pct_{Pair_Direction}, STRING_AGG(Board, ', ') AS Boards, STRING_AGG(Pct_{Pair_Direction}, ', ') AS Pcts_{Pair_Direction} FROM results WHERE Boards_We_Played = True GROUP BY Opponents"
"sql": "SELECT CASE WHEN Opponent_Pair_Direction='NS' THEN CONCAT(section_name, Pair_Number_NS, ' - ', Player_Name_N, ' - ', Player_Name_S) ELSE CONCAT(section_name, Pair_Number_EW, ' - ', Player_Name_E, ' - ', Player_Name_W) END AS Opponents, AVG(Pct_{Pair_Direction}) AS Avg_Pct_{Pair_Direction}, STRING_AGG(Board, ', ') AS Boards, STRING_AGG(ROUND(Pct_{Pair_Direction},2), ', ') AS Pcts_{Pair_Direction} FROM results WHERE Boards_We_Played = True GROUP BY Opponents"
}
]
},
Expand Down

0 comments on commit d58a8dc

Please sign in to comment.