Skip to content

Commit

Permalink
rename vars & handle case when impact=None for map title update
Browse files Browse the repository at this point in the history
  • Loading branch information
alyssadai committed Jun 8, 2024
1 parent 1126c89 commit 12bcf76
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions climate_emotions_map/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,15 @@ def reset_impact_select(question_value):
Output("map-title", "children"),
Input("impact-select", "value"),
State("impact-select", "data"),
prevent_initial_call=True,
)
def update_map_title(impact, opts):
def update_map_title(impact, options):
"""Update the map title when a specific impact is selected (or if the selection is cleared)."""
label = [opt["label"] for opt in opts if opt["value"] == impact]
return utils.create_map_title(label[0])
label = next(
(option["label"] for option in options if option["value"] == impact),
None,
)
return utils.create_map_title(label)


@callback(
Expand Down

0 comments on commit 12bcf76

Please sign in to comment.