Skip to content

Commit

Permalink
RLPPTM: facility info to provide number of positive tests in reporting
Browse files Browse the repository at this point in the history
interval
  • Loading branch information
nursix committed Jul 13, 2022
1 parent 7bdf290 commit dfa43e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nursix-dev-5445-ge49f46cb6 (2022-07-08 15:21:39)
nursix-dev-5446-g7bdf29081 (2022-07-13 23:25:37)
10 changes: 6 additions & 4 deletions modules/templates/RLPPTM/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2371,16 +2371,18 @@ def facility_info(r, **attr):
query &= (table.date <= end)
query &= (table.deleted == False)
total = table.tests_total.sum()
row = db(query).select(total).first()
positive = table.tests_positive.sum()
row = db(query).select(total, positive).first()
tests_total = row[total]
if not tests_total:
tests_total = 0
tests_positive = row[positive]

# Add to output
output["report"] = [start.isoformat() if start else None,
end.isoformat() if end else None,
]
output["activity"] = {"tests": tests_total}
output["activity"] = {"tests": tests_total if tests_total else 0,
"positive": tests_positive if tests_positive else 0,
}
else:
r.error(400, "Invalid report parameter format")

Expand Down

0 comments on commit dfa43e3

Please sign in to comment.