-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
105 move settings to session state #111
Conversation
app/ptxboa_functions.py
Outdated
@@ -147,8 +109,10 @@ def aggregate_costs(res_details: pd.DataFrame) -> pd.DataFrame: | |||
|
|||
# Settings: | |||
def create_sidebar(api: PtxboaAPI): | |||
if "settings" not in st.session_state: | |||
st.session_state["settings"] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason you put settings in a dictionary inside session state and do not place each entry in settings in the session state as an individual key? This would make code that accesses a single setting value more concise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm. I thought it would be nice to have all settings grouped together in a dictionary. But you are right, there is no real need for this. Good point.
I moved the
settings
dictionary tost.session_state["settings"]
. keep in mind that unittests do not work for functions that callst.session_state
. This is why I removed the legacycalculate_results
function and the associated test.We should try to set up the streamlit testing framework #112
@joAschauer I hope these changes do not conflict with the work you are currently doing