Private
Public Access
1
0

Merge branch 'release/v12.87'

This commit is contained in:
Sander Roosendaal
2020-06-10 08:24:19 +02:00
6 changed files with 127 additions and 72 deletions
+9 -3
View File
@@ -90,8 +90,15 @@ def cpfit(powerdf):
def getlogarr(maxt):
maxlog10 = np.log10(maxt-5)
logarr = np.arange(50)*maxlog10/50.
logarr = [5+int(10.**(la)) for la in logarr]
logarr = pd.Series(logarr)
res = []
for la in logarr:
try:
v = 5+int(10.**(la))
except ValueError:
v = 0
res.append(v)
logarr = pd.Series(res)
logarr.drop_duplicates(keep='first',inplace=True)
logarr = logarr.values
@@ -332,4 +339,3 @@ def getmaxwattinterval(tt,ww,i):
deltat = 0
return deltat,wmax
+13 -1
View File
@@ -261,6 +261,18 @@ def pretty_timedelta(secs):
return '{}:{:02}:{:02}'.format(int(hours),int(minutes),int(seconds))
def mapcolors(x):
try:
return mytypes.color_map[x]
except KeyError:
return mytypes.colors[-1]
def maptypes(x):
try:
return mytypes.workouttypes_ordered[x]
except KeyError:
return 'Other'
def interactive_workouttype_piechart(workouts):
if len(workouts) == 0:
return "","Not enough workouts to make a chart"
@@ -286,7 +298,7 @@ def interactive_workouttype_piechart(workouts):
data = pd.DataFrame(data)
data['color'] = data['type'].apply(lambda x:mytypes.color_map[x])
data['color'] = data['type'].apply(lambda x:mapcolors(x))
data['totaltime'] = data['value'].apply(lambda x:pretty_timedelta(x))
data['type'] = data['type'].apply(lambda x:mytypes.workouttypes_ordered[x])
+2 -1
View File
@@ -273,7 +273,8 @@ checktypes = [i[0] for i in workouttypes]
from bokeh.palettes import Category10,Category20, Category20c
colors = Category10[9]+Category20[19]+Category20c[19]
#colors = Category10[9]
colors = Category10[9]+list(set(Category20[19]+Category20c[19]))
color_map = {checktypes[i]:colors[i] for i in range(len(checktypes))}
workoutsources = (
+6 -1
View File
@@ -30,6 +30,7 @@ import datetime
import pytz
import iso8601
from json.decoder import JSONDecodeError
from matplotlib.backends.backend_agg import FigureCanvas
#from matplotlib.backends.backend_cairo import FigureCanvasCairo as FigureCanvas
@@ -380,8 +381,9 @@ def handle_check_race_course(self,
except IOError:
return 0
row.calc_dist_from_gps()
rowdata = row.df
rowdata['cum_dist'] = rowdata['gps_dist_calculated']
try:
s = rowdata[' latitude']
@@ -2028,7 +2030,10 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename,
elif (plotnr == 2):
fig1 = row.get_metersplot_erg(t,pacerange=oterange,**kwargs)
elif (plotnr == 3):
try:
t += ' - Heart Rate Distribution'
except TypeError:
t = 'Heart Rate Distribution'
fig1 = row.get_piechart(t,**kwargs)
elif (plotnr == 4):
if haspower:
+10
View File
@@ -1640,6 +1640,7 @@ def virtualevent_addboat_view(request,id=0):
race = race).exclude(userid = r.id)
for otherrecord in otherrecords:
try:
otheruser = Rower.objects.get(id=otherrecord.userid)
othername = otheruser.user.first_name+' '+otheruser.user.last_name
registeredname = r.user.first_name+' '+r.user.last_name
@@ -1652,6 +1653,9 @@ def virtualevent_addboat_view(request,id=0):
race.name,
race.id
)
except Rower.DoesNotExist:
pass
followers = VirtualRaceFollower.objects.filter(race = race)
@@ -1868,6 +1872,7 @@ def virtualevent_register_view(request,id=0):
race = race).exclude(userid = r.id)
for otherrecord in otherrecords:
try:
otheruser = Rower.objects.get(id=otherrecord.userid)
othername = otheruser.user.first_name+' '+otheruser.user.last_name
registeredname = r.user.first_name+' '+r.user.last_name
@@ -1880,6 +1885,8 @@ def virtualevent_register_view(request,id=0):
race.name,
race.id
)
except Rower.DoesNotExist:
pass
followers = VirtualRaceFollower.objects.filter(race = race)
@@ -2136,6 +2143,7 @@ def indoorvirtualevent_register_view(request,id=0):
race = race).exclude(userid = r.id)
for otherrecord in otherrecords:
try:
otheruser = Rower.objects.get(id=otherrecord.userid)
othername = otheruser.user.first_name+' '+otheruser.user.last_name
registeredname = r.user.first_name+' '+r.user.last_name
@@ -2148,6 +2156,8 @@ def indoorvirtualevent_register_view(request,id=0):
race.name,
race.id
)
except Rower.DoesNotExist:
pass
followers = VirtualRaceFollower.objects.filter(race = race)
+21
View File
@@ -5913,13 +5913,34 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
# we are saving the results obtained from the split by power/pace interpreter
elif request.method == 'POST' and "savepowerpaceform" in request.POST:
try:
powerorpace = request.POST['powerorpace']
except:
powerorpace = 'pace'
try:
value_pace = request.POST['value_pace']
except:
value_pace = avpace
try:
value_power = request.POST['value_power']
except:
value_power = int(normp)
try:
value_work = request.POST['value_work']
except:
value_work = int(normw)
try:
value_spm = request.POST['value_spm']
except:
value_spm = int(normspm)
try:
activeminutesmin = request.POST['activeminutesmin']
except:
activeminutesmin = 0
try:
activeminutesmax = request.POST['activeminutesmax']
except:
pass
try:
activesecondsmin = 60.*float(activeminutesmin)
activesecondsmax = 60.*float(activeminutesmax)