Skip to content

Commit

Permalink
Merge pull request #351 from noharm-ai/develop
Browse files Browse the repository at this point in the history
fix intervals cache
  • Loading branch information
marceloarocha authored Aug 9, 2024
2 parents 1bf4358 + e8312b6 commit d717fac
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions routes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,20 +511,20 @@ def getFeatures(result, agg_date: datetime = None, intervals_for_agg_date=False)
diff += int(not d["checked"])
tube += int(d["tubeAlert"])

if (
intervals_for_agg_date
and agg_date != None
and d["prescriptionDate"] != None
and dateutils.to_iso(agg_date).split("T")[0]
== d["prescriptionDate"].split("T")[0]
):
if intervals_for_agg_date:
# add interval for agg_date
# must be the same prescription date (individual and agg)
if d.get("interval", None) != None:
times = split_interval(d.get("interval"))
for t in times:
if not t in intervals:
intervals.append(t)
if (
agg_date != None
and d["prescriptionDate"] != None
and dateutils.to_iso(agg_date).split("T")[0]
== d["prescriptionDate"].split("T")[0]
):
# must be the same prescription date (individual and agg)
if d.get("interval", None) != None:
times = split_interval(d.get("interval"))
for t in times:
if not t in intervals:
intervals.append(t)
else:
# add all intervals
if d.get("interval", None) != None:
Expand Down

0 comments on commit d717fac

Please sign in to comment.