From cd8cdbb467c60c4ce1046e15fead00727855bdc3 Mon Sep 17 00:00:00 2001 From: Zachary Clement Date: Fri, 25 Oct 2024 14:30:47 -0400 Subject: [PATCH] Don't check against empty timings array (#250) Co-authored-by: Ilya Sytchev --- forest/sycamore/common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/forest/sycamore/common.py b/forest/sycamore/common.py index d372b84f..e8bb1aa5 100644 --- a/forest/sycamore/common.py +++ b/forest/sycamore/common.py @@ -628,6 +628,11 @@ def find_missing_data(user: str, survey_id: str, agg_data: pd.DataFrame, ].unique() missing_times = [] for time in known_answers_submits: + # If there were no timings submits recorded, every answers + # submit will be missing + if len(known_timings_submits) == 0: + missing_times.append(time) + continue hours_from_nearest = np.min( np.abs((pd.to_datetime(known_timings_submits) @@ -635,7 +640,7 @@ def find_missing_data(user: str, survey_id: str, agg_data: pd.DataFrame, ) / 60 / 60 # add on the data if there is more than 1/2 hour between an # answers submission and a timing submission. - if hours_from_nearest > .5 or len(known_timings_submits) == 0: + if hours_from_nearest > .5: missing_times.append(time) if len(missing_times) > 0: missing_data = answers_data.loc[