Spaces:
Running
Running
Change Default Setting
Browse files- streamlit_app.py +12 -2
streamlit_app.py
CHANGED
|
@@ -674,12 +674,22 @@ def gather_branch_options() -> tuple[list[str], list[str]]:
|
|
| 674 |
|
| 675 |
restaurants_all, branches_all = gather_branch_options()
|
| 676 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 677 |
st.sidebar.title("Filters")
|
| 678 |
sel_restaurants = st.sidebar.multiselect(
|
| 679 |
-
"Restaurant", restaurants_all, default=
|
| 680 |
)
|
| 681 |
sel_branches = st.sidebar.multiselect(
|
| 682 |
-
"Branch", branches_all, default=
|
| 683 |
)
|
| 684 |
|
| 685 |
# Year + date range
|
|
|
|
| 674 |
|
| 675 |
restaurants_all, branches_all = gather_branch_options()
|
| 676 |
|
| 677 |
+
# Default to Copper Buffet (TheSense + Gaysorn) on first load. Fall back to
|
| 678 |
+
# "everything" if those values don't appear in the dataset — e.g. before the
|
| 679 |
+
# first data refresh after a schema change.
|
| 680 |
+
_DEFAULT_RESTAURANTS = ["Copper Buffet"]
|
| 681 |
+
_DEFAULT_BRANCHES = ["TheSense", "Gaysorn"]
|
| 682 |
+
_restaurant_defaults = [r for r in _DEFAULT_RESTAURANTS if r in restaurants_all] \
|
| 683 |
+
or restaurants_all
|
| 684 |
+
_branch_defaults = [b for b in _DEFAULT_BRANCHES if b in branches_all] \
|
| 685 |
+
or branches_all
|
| 686 |
+
|
| 687 |
st.sidebar.title("Filters")
|
| 688 |
sel_restaurants = st.sidebar.multiselect(
|
| 689 |
+
"Restaurant", restaurants_all, default=_restaurant_defaults
|
| 690 |
)
|
| 691 |
sel_branches = st.sidebar.multiselect(
|
| 692 |
+
"Branch", branches_all, default=_branch_defaults
|
| 693 |
)
|
| 694 |
|
| 695 |
# Year + date range
|