Skip to content

Commit 8b69835

Browse files
committed
catch a error
1 parent 285cc03 commit 8b69835

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

code/util/plot_autotrain_manager.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,9 @@ def plot_manager_all_progress_bokeh_source(
158158
df_subject["y"] = len(subject_ids) - n
159159
df_subjects.append(df_subject)
160160

161+
if not df_subjects:
162+
return None, None
163+
161164
data_df = pd.concat(df_subjects, ignore_index=True)
162165

163166
return data_df, subject_ids
@@ -188,6 +191,10 @@ def plot_manager_all_progress_bokeh(
188191
if_use_filtered_data=if_use_filtered_data,
189192
filtered_session_ids=filtered_session_ids,
190193
)
194+
195+
if data_df is None:
196+
return None, None
197+
191198
source = ColumnDataSource(data_df)
192199

193200
# Add hover tool

code/util/streamlit.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,6 @@ def add_auto_train_manager():
839839
highlight_subjects = []
840840

841841
# --- Bokeh ---
842-
843842
fig_auto_train, data_df = plot_manager_all_progress_bokeh(
844843
x_axis=x_axis,
845844
recent_days=recent_months * 30.437, # Turn months into days
@@ -856,6 +855,10 @@ def add_auto_train_manager():
856855
else None
857856
),
858857
)
858+
859+
if fig_auto_train is None:
860+
st.markdown("### In the filtered sessions, no AutoTrain history to show!")
861+
return
859862

860863
event_result = streamlit_bokeh3_events(
861864
events="TestSelectEvent",

0 commit comments

Comments
 (0)