From 8d2bcad65ae08b43ba8b2671ff35f27a33267373 Mon Sep 17 00:00:00 2001 From: bjhardcastle Date: Fri, 22 Nov 2024 19:23:06 -0800 Subject: [PATCH] Fix `is_stage_5_passed` --- src/npc_sessions/sessions.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/npc_sessions/sessions.py b/src/npc_sessions/sessions.py index d3b4c45..d5f9802 100644 --- a/src/npc_sessions/sessions.py +++ b/src/npc_sessions/sessions.py @@ -2002,8 +2002,6 @@ def is_stage_5_passed(self) -> bool: f"Could not find {subject_id} in training spreadsheets (and not a known Templeton session) - returning is_stage_5_passed = False, but this may be incorrect" ) return False - - df = df[df["task version"].str.startswith("stage 5")] if df.empty: return False return np.isnan( @@ -2012,9 +2010,9 @@ def is_stage_5_passed(self) -> bool: df=df, sessions=np.where( [ - str(d).split(" ")[0] - < self.session_start_time.strftime("%Y-%m-%d") - for d in df["start time"].values + (str(start_time).split(" ")[0] < self.session_start_time.strftime("%Y-%m-%d")) + and str(task_version).startswith("stage 5") + for start_time, task_version in df[["start time", "task version"]].values ] )[0], stage=5,