Skip to content

Commit

Permalink
use key instead of titlestring to construct widget keys
Browse files Browse the repository at this point in the history
  • Loading branch information
markushal committed Nov 14, 2023
1 parent e2dcc4a commit 380fae5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/ptxboa_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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:
Expand All @@ -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)
Expand Down

0 comments on commit 380fae5

Please sign in to comment.