Private
Public Access
1
0

Merge branch 'release/v14.55'

This commit is contained in:
Sander Roosendaal
2020-11-24 19:34:58 +01:00

View File

@@ -1624,12 +1624,14 @@ def fitnessfit_chart(workouts,user,workoutmode='water',startdate=None,
df.sort_values(['date'],inplace=True)
#df = df.fillna(0)
df['testdup'] = df['testpower'].shift(1)
df['testpower'] = df.apply(lambda x: np.nan if abs(x['testpower'] - x['testdup']) < 4 \
else x['testpower'],axis=1)
#df = df.fillna(-100)
#print(df)
source = ColumnDataSource(
data = dict(
@@ -1644,6 +1646,7 @@ def fitnessfit_chart(workouts,user,workoutmode='water',startdate=None,
plot = Figure(tools=TOOLS,x_axis_type='datetime',
plot_width=900,
toolbar_location="above",
@@ -1700,7 +1703,7 @@ def fitnessfit_chart(workouts,user,workoutmode='water',startdate=None,
plot.xaxis.major_label_orientation = pi/4
plot.sizing_mode = 'stretch_both'
plot.y_range = Range1d(0,1.5*max(testpower))
#plot.y_range = Range1d(0,1.5*max(df['testpower']))
startdate = datetime.datetime.combine(startdate,datetime.datetime.min.time())
enddate = datetime.datetime.combine(enddate,datetime.datetime.min.time())
@@ -1718,13 +1721,14 @@ def fitnessfit_chart(workouts,user,workoutmode='water',startdate=None,
try:
script,div = components(plot)
except:
except Exception as e:
df.dropna(inplace=True,axis=0,how='any')
return (
'',
'Something went wrong withthe chart ({nrworkouts} workouts, {nrdata} datapoints)'.format(
'Something went wrong with the chart ({nrworkouts} workouts, {nrdata} datapoints, error {e})'.format(
nrworkouts = workouts.count(),
nrdata = len(df),
e = e,
)
)