Skip to content

Commit

Permalink
Don't check against empty timings array (#250)
Browse files Browse the repository at this point in the history
Co-authored-by: Ilya Sytchev <[email protected]>
  • Loading branch information
clementzach and hackdna authored Oct 25, 2024
1 parent 7c9f83c commit cd8cdbb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion forest/sycamore/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,14 +628,19 @@ 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)
- pd.to_datetime(time)).total_seconds())
) / 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[
Expand Down

0 comments on commit cd8cdbb

Please sign in to comment.