fix alerts
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user