Merge branch 'develop' into feature/popupregatta
This commit is contained in:
@@ -721,7 +721,13 @@ def fetchcp(rower,theworkouts,table='cpdata'):
|
|||||||
return pd.Series([]),pd.Series([]),avgpower2
|
return pd.Series([]),pd.Series([]),avgpower2
|
||||||
|
|
||||||
dfgrouped = df.groupby(['workoutid'])
|
dfgrouped = df.groupby(['workoutid'])
|
||||||
avgpower2 = dict(dfgrouped.mean()['power'].astype(int))
|
try:
|
||||||
|
avgpower2 = dict(dfgrouped.mean()['power'].astype(int))
|
||||||
|
except KeyError:
|
||||||
|
avgpower2 = {}
|
||||||
|
for id in theids:
|
||||||
|
avgpower2[id] = 0
|
||||||
|
return pd.Series([]),pd.Series([]),avgpower2
|
||||||
|
|
||||||
cpdf = getcpdata_sql(rower.id,table=table)
|
cpdf = getcpdata_sql(rower.id,table=table)
|
||||||
|
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ class UploadOptionsForm(forms.Form):
|
|||||||
plotchoices = (
|
plotchoices = (
|
||||||
('timeplot','Time Plot'),
|
('timeplot','Time Plot'),
|
||||||
('distanceplot','Distance Plot'),
|
('distanceplot','Distance Plot'),
|
||||||
('pieplot','Pie Chart'),
|
('pieplot','Heart Rate Pie Chart'),
|
||||||
)
|
)
|
||||||
make_plot = forms.BooleanField(initial=False,required=False)
|
make_plot = forms.BooleanField(initial=False,required=False)
|
||||||
plottype = forms.ChoiceField(required=False,
|
plottype = forms.ChoiceField(required=False,
|
||||||
|
|||||||
@@ -3468,8 +3468,11 @@ def thumbnail_flex_chart(rowdata,id=0,promember=0,
|
|||||||
plot.yaxis.axis_label = 'Y'
|
plot.yaxis.axis_label = 'Y'
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
yrange1 = Range1d(start=yaxminima[yparam1],end=yaxmaxima[yparam1])
|
yrange1 = Range1d(start=yaxminima[yparam1],end=yaxmaxima[yparam1])
|
||||||
|
except KeyError:
|
||||||
|
yrange1 = Range1d(start=yparam1.min(), end=yparam1.max())
|
||||||
|
|
||||||
plot.y_range = yrange1
|
plot.y_range = yrange1
|
||||||
|
|
||||||
if (xparam != 'time') and (xparam != 'distance') and (xparam != 'cumdist'):
|
if (xparam != 'time') and (xparam != 'distance') and (xparam != 'cumdist'):
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="grid_2 alpha">
|
<div class="grid_2 alpha">
|
||||||
<p>
|
<p>
|
||||||
<a class="button blue small" href="/rowers/workout/{{ workout.id }}/addpiechart">Add Pie Chart</a>
|
<a class="button blue small" href="/rowers/workout/{{ workout.id }}/addpiechart">Add HR Pie Chart</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_2 alpha">
|
<div class="grid_2 alpha">
|
||||||
|
|||||||
@@ -137,7 +137,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="grid_2 omega">
|
<div class="grid_2 omega">
|
||||||
<p>
|
<p>
|
||||||
<a class="button blue small" href="/rowers/workout/{{ workout.id }}/addpiechart">Add Pie Chart</a>
|
<a class="button blue small" href="/rowers/workout/{{ workout.id }}/addpiechart">Add HR Pie Chart</a>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_6 alpha">
|
<div class="grid_6 alpha">
|
||||||
|
|||||||
@@ -2747,6 +2747,10 @@ def histo_all(request,theuser=0,
|
|||||||
if enddatestring != "":
|
if enddatestring != "":
|
||||||
enddate = iso8601.parse_date(enddatestring)
|
enddate = iso8601.parse_date(enddatestring)
|
||||||
|
|
||||||
|
|
||||||
|
startdate = datetime.datetime.combine(startdate,datetime.time())
|
||||||
|
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
||||||
|
|
||||||
if enddate < startdate:
|
if enddate < startdate:
|
||||||
s = enddate
|
s = enddate
|
||||||
enddate = startdate
|
enddate = startdate
|
||||||
@@ -6414,9 +6418,8 @@ def courses_view(request):
|
|||||||
# List Workouts
|
# List Workouts
|
||||||
@login_required()
|
@login_required()
|
||||||
def workouts_view(request,message='',successmessage='',
|
def workouts_view(request,message='',successmessage='',
|
||||||
startdatestring="",enddatestring="",
|
startdatestring='',
|
||||||
startdate=timezone.now()-datetime.timedelta(days=365),
|
enddatestring='',
|
||||||
enddate=timezone.now(),
|
|
||||||
teamid=0,rankingonly=False,rowerid=0,userid=0):
|
teamid=0,rankingonly=False,rowerid=0,userid=0):
|
||||||
|
|
||||||
request.session['referer'] = absolute(request)['PATH']
|
request.session['referer'] = absolute(request)['PATH']
|
||||||
@@ -6436,13 +6439,26 @@ def workouts_view(request,message='',successmessage='',
|
|||||||
if not checkaccessuser(request.user,r):
|
if not checkaccessuser(request.user,r):
|
||||||
raise PermissionDenied("Access denied")
|
raise PermissionDenied("Access denied")
|
||||||
|
|
||||||
|
if startdatestring:
|
||||||
|
startdate = iso8601.parse_date(startdatestring)
|
||||||
|
else:
|
||||||
|
startdate = datetime.date.today()-datetime.timedelta(days=365)
|
||||||
|
|
||||||
|
if enddatestring:
|
||||||
|
enddate = iso8601.parse_date(enddatestring)
|
||||||
|
else:
|
||||||
|
enddate = datetime.date.today()
|
||||||
|
|
||||||
|
|
||||||
|
startdate = datetime.datetime.combine(startdate,datetime.time())
|
||||||
|
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
||||||
|
|
||||||
|
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
dateform = DateRangeForm(request.POST)
|
dateform = DateRangeForm(request.POST)
|
||||||
if dateform.is_valid():
|
if dateform.is_valid():
|
||||||
startdate = dateform.cleaned_data['startdate']
|
startdate = dateform.cleaned_data['startdate']
|
||||||
enddate = dateform.cleaned_data['enddate']
|
enddate = dateform.cleaned_data['enddate']
|
||||||
startdatestring = None
|
|
||||||
enddatestring = None
|
|
||||||
else:
|
else:
|
||||||
dateform = DateRangeForm(initial={
|
dateform = DateRangeForm(initial={
|
||||||
'startdate':startdate,
|
'startdate':startdate,
|
||||||
@@ -6453,16 +6469,15 @@ def workouts_view(request,message='',successmessage='',
|
|||||||
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
||||||
#enddate = enddate+datetime.timedelta(days=1)
|
#enddate = enddate+datetime.timedelta(days=1)
|
||||||
|
|
||||||
if startdatestring:
|
|
||||||
startdate = iso8601.parse_date(startdatestring)
|
|
||||||
if enddatestring:
|
|
||||||
enddate = iso8601.parse_date(enddatestring)
|
|
||||||
|
|
||||||
if enddate < startdate:
|
if enddate < startdate:
|
||||||
s = enddate
|
s = enddate
|
||||||
enddate = startdate
|
enddate = startdate
|
||||||
startdate = s
|
startdate = s
|
||||||
|
|
||||||
|
startdatestring = startdate.strftime('%Y-%m-%d')
|
||||||
|
enddatestring = enddate.strftime('%Y-%m-%d')
|
||||||
|
|
||||||
# start date for the small graph
|
# start date for the small graph
|
||||||
activity_startdate = enddate-datetime.timedelta(days=15)
|
activity_startdate = enddate-datetime.timedelta(days=15)
|
||||||
|
|
||||||
@@ -7650,7 +7665,7 @@ def cumstats(request,theuser=0,
|
|||||||
|
|
||||||
if waterinclude:
|
if waterinclude:
|
||||||
allergworkouts = workoutse | workoutsw
|
allergworkouts = workoutse | workoutsw
|
||||||
allergworkouts = workouts.distinct().order_by("-date", "-starttime")
|
allergworkouts = allergworkouts.distinct().order_by("-date", "-starttime")
|
||||||
else:
|
else:
|
||||||
allergworkouts = workoutse.order_by("-date","-starttime")
|
allergworkouts = workoutse.order_by("-date","-starttime")
|
||||||
|
|
||||||
@@ -8416,11 +8431,20 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
|||||||
workstrokesonly = request.POST['workstrokesonlysave']
|
workstrokesonly = request.POST['workstrokesonlysave']
|
||||||
reststrokes = not workstrokesonly
|
reststrokes = not workstrokesonly
|
||||||
r = getrower(request.user)
|
r = getrower(request.user)
|
||||||
f = FavoriteChart(user=r,xparam=xparam,
|
try:
|
||||||
|
r = metrics.yaxmaxima[xparam]
|
||||||
|
if yparam1 is not None:
|
||||||
|
r = metrics.yaxmaxima[yparam1]
|
||||||
|
if yparam2 is not None:
|
||||||
|
r = metrics.yaxmaxima[yparam2]
|
||||||
|
f = FavoriteChart(user=r,xparam=xparam,
|
||||||
yparam1=yparam1,yparam2=yparam2,
|
yparam1=yparam1,yparam2=yparam2,
|
||||||
plottype=plottype,workouttype=workouttype,
|
plottype=plottype,workouttype=workouttype,
|
||||||
reststrokes=reststrokes)
|
reststrokes=reststrokes)
|
||||||
f.save()
|
f.save()
|
||||||
|
|
||||||
|
except KeyError:
|
||||||
|
messages.error(request,'We cannot save the ad hoc metrics in a favorite chart')
|
||||||
|
|
||||||
if request.method == 'POST' and 'workstrokesonly' in request.POST:
|
if request.method == 'POST' and 'workstrokesonly' in request.POST:
|
||||||
workstrokesonly = request.POST['workstrokesonly']
|
workstrokesonly = request.POST['workstrokesonly']
|
||||||
|
|||||||
Reference in New Issue
Block a user