From d8aa2c83549db5c5f34124982df138569f3b34b1 Mon Sep 17 00:00:00 2001 From: Pratham Soni Date: Mon, 1 Jul 2024 10:03:11 -0500 Subject: [PATCH] sort batch_ids by descending order --- streamlit/interface_1.py | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/streamlit/interface_1.py b/streamlit/interface_1.py index 2e297c8..475d3e1 100644 --- a/streamlit/interface_1.py +++ b/streamlit/interface_1.py @@ -102,36 +102,39 @@ if client: # 'batch_160524071331', 'batch_200524213550', 'batch_250424112237', 'batch_280524120530', 'batch_280524121721', 'batch_280524144222', # 'batch_290524123926', 'batch_290524164044', 'batch_310524102029', 'batch_310524124050', 'batch_310524162346', 'batch_310524162631'] - if 'sorted_list' not in st.session_state: - st.session_state.sorted_list = batch_list - def sort_list(ex_list, sort_by, order): - if sort_by == 'Alphabetical': - ex_list = sorted(ex_list, reverse=(order == 'Descending')) - elif sort_by == 'Create Date': - ex_list = ex_list if order == 'Ascending' else list(reversed(ex_list)) + #Select Box for Applying Different Sort for the Batch List - return ex_list + # if 'sorted_list' not in st.session_state: + # st.session_state.sorted_list = batch_list - col1, col2, col3, col4 = st.columns([0.5, 0.5, 0.5, 0.5]) + # def sort_list(ex_list, sort_by, order): + # if sort_by == 'Alphabetical': + # ex_list = sorted(ex_list, reverse=(order == 'Descending')) + # elif sort_by == 'Create Date': + # ex_list = ex_list if order == 'Ascending' else list(reversed(ex_list)) + + # return ex_list + + # col1, col2, col3, col4 = st.columns([0.5, 0.5, 0.5, 0.5]) - with col1: - sort_by = st.radio("**Sort Batch_IDs**", ('Alphabetical', 'Create Date')) + # with col1: + # sort_by = st.radio("**Sort Batch_IDs**", ('Alphabetical', 'Create Date')) - with col2: - order = st.radio('', ('Ascending','Descending')) + # with col2: + # order = st.radio('', ('Ascending','Descending')) - with col3: - add_vertical_space(2) - if st.button('Apply'): - st.session_state.sorted_list = sort_list(batch_list, sort_by, order) + # with col3: + # add_vertical_space(2) + # if st.button('Apply'): + # st.session_state.sorted_list = sort_list(batch_list, sort_by, order) path_row = st.columns([0.1, 0.8]) with path_row[0]: st.write("**Batch ID**") with path_row[1]: - batch_id = st.selectbox('**Batch ID**', st.session_state.sorted_list, label_visibility = "collapsed", index = None) + batch_id = st.selectbox('**Batch ID**', reversed(batch_list) , label_visibility = "collapsed", index = None) if not batch_id: batch_id = "None"