Skip to content
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

Don't check against empty timings array #250

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading