From 380fae5d9647daaf91aeeb6faccf2be6b4677bbe Mon Sep 17 00:00:00 2001 From: Markus Haller Date: Tue, 14 Nov 2023 09:10:26 +0100 Subject: [PATCH] use key instead of titlestring to construct widget keys --- app/ptxboa_functions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/ptxboa_functions.py b/app/ptxboa_functions.py index 5d143871..b93f4172 100644 --- a/app/ptxboa_functions.py +++ b/app/ptxboa_functions.py @@ -677,7 +677,7 @@ def display_costs( df_res = df_costs.copy() # select filter: - if titlestring == "Costs by region:": + if titlestring == "region": option_list = ["All", "Ten cheapest", "Manual select"] else: option_list = ["All", "Manual select"] @@ -686,7 +686,7 @@ def display_costs( "Select elements to display:", option_list, index=0, - key=f"show_which_data_{titlestring}", + key=f"show_which_data_{key}", ) # apply filter: @@ -697,13 +697,13 @@ def display_costs( "Select regions:", df_res.index.values, default=df_res.index.values, - key=f"select_data_{titlestring}", + key=f"select_data_{key}", ) df_res = df_res.loc[ind_select] # sort: sort_ascending = st.toggle( - "Sort by total costs?", value=True, key=f"sort_data_{titlestring}" + "Sort by total costs?", value=True, key=f"sort_data_{key}" ) if sort_ascending: df_res = df_res.sort_values(["Total"], ascending=True)