first version analyses collection
This commit is contained in:
@@ -1845,6 +1845,32 @@ def agegrouprecordview(request, sex='male', weightcategory='hwt',
|
||||
})
|
||||
|
||||
|
||||
@login_required
|
||||
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
||||
def instrokeanalysis_view(request, userid=0):
|
||||
r = getrequestrower(request, userid=userid)
|
||||
|
||||
analyses = InStrokeAnalysis.objects.filter(rower=r).order_by("-date")
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url': '/rowers/analysis',
|
||||
'name': 'Analysis'
|
||||
},
|
||||
{
|
||||
'url': reverse('instrokeanalysis_view'),
|
||||
'name': 'In-Stroke Analysis',
|
||||
},
|
||||
]
|
||||
|
||||
return render(request, 'instroke_analysis.html',
|
||||
{
|
||||
'breadcrumbs': breadcrumbs,
|
||||
'analyses': analyses,
|
||||
'rower': r,
|
||||
})
|
||||
|
||||
|
||||
@login_required
|
||||
@permission_required('rower.is_coach', fn=get_user_by_userid, raise_exception=True)
|
||||
def alerts_view(request, userid=0):
|
||||
|
||||
@@ -153,7 +153,7 @@ from rowers.models import (
|
||||
VideoAnalysis, ShareKey,
|
||||
StandardCollection, CourseStandard,
|
||||
VirtualRaceFollower, TombStone, InstantPlan,
|
||||
PlannedSessionStep,
|
||||
PlannedSessionStep,InStrokeAnalysis,
|
||||
)
|
||||
from rowers.models import (
|
||||
RowerPowerForm, RowerHRZonesForm, RowerForm, RowerCPForm, GraphImage, AdvancedWorkoutForm,
|
||||
|
||||
@@ -2981,6 +2981,8 @@ def instroke_chart_interactive(request, id=0):
|
||||
metric = instrokemetrics[0]
|
||||
spm_min = 15
|
||||
spm_max = 45
|
||||
name = ''
|
||||
notes = ''
|
||||
|
||||
activeminutesmax = int(rowdata.duration/60.)
|
||||
activeminutesmin = 0
|
||||
@@ -2996,6 +2998,24 @@ def instroke_chart_interactive(request, id=0):
|
||||
activeminutesmin = form.cleaned_data['activeminutesmin']
|
||||
activeminutesmax = form.cleaned_data['activeminutesmax']
|
||||
individual_curves = form.cleaned_data['individual_curves']
|
||||
notes = form.cleaned_data['notes']
|
||||
name = form.cleaned_data['name']
|
||||
|
||||
if "_save" in request.POST:
|
||||
instroke_analysis = InStrokeAnalysis(
|
||||
workout = w,
|
||||
metric = metric,
|
||||
name = name,
|
||||
date = timezone.now().date(),
|
||||
notes = notes,
|
||||
start_second = 60*activeminutesmin,
|
||||
end_second = 60*activeminutesmax,
|
||||
spm_min = spm_min,
|
||||
spm_max = spm_max,
|
||||
rower=w.user,
|
||||
)
|
||||
instroke_analysis.save()
|
||||
messages.info(request,'In-Stroke Analysis saved')
|
||||
|
||||
|
||||
activesecondsmin = 60.*activeminutesmin
|
||||
@@ -3016,6 +3036,7 @@ def instroke_chart_interactive(request, id=0):
|
||||
activeminutesmin,
|
||||
activeminutesmax,
|
||||
individual_curves,
|
||||
name=name,notes=notes,
|
||||
)
|
||||
|
||||
# change to range spm_min to spm_max
|
||||
|
||||
Reference in New Issue
Block a user