Private
Public Access
1
0

fix alerts

This commit is contained in:
Sander Roosendaal
2022-10-24 19:55:33 +02:00
parent 88f39d5f36
commit 88c3cb36e2
3 changed files with 29 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ from rowers.teams import coach_getcoachees
from rowers.dataprep import getsmallrowdata_db, getrowdata_db
import datetime
import numpy as np
import math
def create_alert(manager, rower, measured, period=7, emailalert=True,
reststrokes=False, workouttype='water', boattype='1x',
@@ -195,7 +195,7 @@ def alert_get_stats(alert, nperiod=0): # pragma: no cover
median = df[alert.measured.metric].median()
std = df[alert.measured.metric].std()
return {
data = {
'workouts': workouts.count(),
'startdate': startdate,
'enddate': enddate,
@@ -208,6 +208,18 @@ def alert_get_stats(alert, nperiod=0): # pragma: no cover
'standard_dev': std,
}
data_clean = {}
for k in data:
data_clean[k] = data[k]
try:
if math.isnan(data[k]):
data_clean[k] = 0
except TypeError:
pass
return data_clean
# run alert report
# check alert permission