some bug fixes
This commit is contained in:
@@ -111,6 +111,9 @@ def alert_get_stats(alert,nperiod=0):
|
|||||||
'nr_strokes_qualifying':0,
|
'nr_strokes_qualifying':0,
|
||||||
'percentage':0,
|
'percentage':0,
|
||||||
'nperiod':nperiod,
|
'nperiod':nperiod,
|
||||||
|
'median': 0,
|
||||||
|
'median_q': 0,
|
||||||
|
'standard_dev': 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
# check if filters are in columns list
|
# check if filters are in columns list
|
||||||
@@ -143,6 +146,9 @@ def alert_get_stats(alert,nperiod=0):
|
|||||||
'nr_strokes_qualifying':0,
|
'nr_strokes_qualifying':0,
|
||||||
'percentage':0,
|
'percentage':0,
|
||||||
'nperiod':nperiod,
|
'nperiod':nperiod,
|
||||||
|
'median': 0,
|
||||||
|
'median_q': 0,
|
||||||
|
'standard_dev': 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1104,7 +1104,11 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
|
|||||||
if barchart:
|
if barchart:
|
||||||
# time increments for bar chart
|
# time increments for bar chart
|
||||||
time_increments = rowdatadf.loc[:,' ElapsedTime (sec)'].diff()
|
time_increments = rowdatadf.loc[:,' ElapsedTime (sec)'].diff()
|
||||||
time_increments[0] = time_increments[1]
|
try:
|
||||||
|
time_increments.iloc[0] = time_increments.iloc[1]
|
||||||
|
except (KeyError, IndexError):
|
||||||
|
time_increments.iloc[1] = 1.
|
||||||
|
|
||||||
time_increments = 0.5*time_increments+0.5*np.abs(time_increments)
|
time_increments = 0.5*time_increments+0.5*np.abs(time_increments)
|
||||||
x_right = (t2+time_increments.apply(lambda x:timedeltaconv(x)))
|
x_right = (t2+time_increments.apply(lambda x:timedeltaconv(x)))
|
||||||
|
|
||||||
|
|||||||
@@ -791,14 +791,33 @@ def handle_send_email_alert(
|
|||||||
othertexts = None
|
othertexts = None
|
||||||
|
|
||||||
report = {}
|
report = {}
|
||||||
|
try:
|
||||||
report['Percentage'] = int(stats['percentage'])
|
report['Percentage'] = int(stats['percentage'])
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
report['Number of workouts'] = int(stats['workouts'])
|
report['Number of workouts'] = int(stats['workouts'])
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
report['Data set'] = "{a} strokes out of {b}".format(
|
report['Data set'] = "{a} strokes out of {b}".format(
|
||||||
a = stats['nr_strokes_qualifying'],
|
a = stats['nr_strokes_qualifying'],
|
||||||
b = stats['nr_strokes']
|
b = stats['nr_strokes']
|
||||||
)
|
)
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
report['Median'] = sigdig(stats['median'])
|
report['Median'] = sigdig(stats['median'])
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
report['Median of qualifying strokes'] = sigdig(stats['median_q'])
|
report['Median of qualifying strokes'] = sigdig(stats['median_q'])
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
subject = "Rowsandall.com: {alertname} ({startdate} to {enddate})".format(
|
subject = "Rowsandall.com: {alertname} ({startdate} to {enddate})".format(
|
||||||
startdate = stats['startdate'],
|
startdate = stats['startdate'],
|
||||||
|
|||||||
Reference in New Issue
Block a user