additional metrics are available in flex chart
This commit is contained in:
@@ -916,6 +916,16 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
w.startdatetime = timezone.now()
|
w.startdatetime = timezone.now()
|
||||||
w.save()
|
w.save()
|
||||||
|
|
||||||
|
|
||||||
|
if privacy == 'visible':
|
||||||
|
ts = Team.objects.filter(rower=r)
|
||||||
|
for t in ts:
|
||||||
|
w.team.add(t)
|
||||||
|
|
||||||
|
# put stroke data in database
|
||||||
|
res = dataprep(row.df, id=w.id, bands=True,
|
||||||
|
barchart=True, otwpower=True, empower=True, inboard=inboard)
|
||||||
|
|
||||||
isbreakthrough = False
|
isbreakthrough = False
|
||||||
ishard = False
|
ishard = False
|
||||||
if workouttype == 'water':
|
if workouttype == 'water':
|
||||||
@@ -981,14 +991,6 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if privacy == 'visible':
|
|
||||||
ts = Team.objects.filter(rower=r)
|
|
||||||
for t in ts:
|
|
||||||
w.team.add(t)
|
|
||||||
|
|
||||||
# put stroke data in database
|
|
||||||
res = dataprep(row.df, id=w.id, bands=True,
|
|
||||||
barchart=True, otwpower=True, empower=True, inboard=inboard)
|
|
||||||
|
|
||||||
return (w.id, message)
|
return (w.id, message)
|
||||||
|
|
||||||
@@ -1150,14 +1152,6 @@ def new_workout_from_file(r, f2,
|
|||||||
a = MessageAttachment(message=msg,document=f3)
|
a = MessageAttachment(message=msg,document=f3)
|
||||||
a.save()
|
a.save()
|
||||||
|
|
||||||
# res = myqueue(
|
|
||||||
# queuelow,
|
|
||||||
# handle_zip_file,
|
|
||||||
# r.user.email,
|
|
||||||
# title,
|
|
||||||
# f2
|
|
||||||
# )
|
|
||||||
|
|
||||||
return -1, message, f2
|
return -1, message, f2
|
||||||
|
|
||||||
# Some people try to upload Concept2 logbook summaries
|
# Some people try to upload Concept2 logbook summaries
|
||||||
@@ -1564,7 +1558,7 @@ def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True):
|
|||||||
cdata2 = savgol_filter(cdata.values,windowsize,3)
|
cdata2 = savgol_filter(cdata.values,windowsize,3)
|
||||||
|
|
||||||
print len(cdata),len(cdata2),'mies'
|
print len(cdata),len(cdata2),'mies'
|
||||||
data[c] = cdata
|
data[c] = cdata2
|
||||||
except KeyError:
|
except KeyError:
|
||||||
data[c] = 0
|
data[c] = 0
|
||||||
|
|
||||||
@@ -1642,12 +1636,14 @@ def read_cols_df_sql(ids, columns, convertnewtons=True):
|
|||||||
axx = [f.name for f in StrokeData._meta.get_fields()]
|
axx = [f.name for f in StrokeData._meta.get_fields()]
|
||||||
|
|
||||||
extracols = []
|
extracols = []
|
||||||
|
|
||||||
|
|
||||||
for c in columns:
|
for c in columns:
|
||||||
if not c in axx:
|
if not c in axx:
|
||||||
columns.remove(c)
|
columns.remove(c)
|
||||||
extracols.append(c)
|
extracols.append(c)
|
||||||
|
|
||||||
|
|
||||||
columns = list(columns) + ['distance', 'spm', 'workoutid']
|
columns = list(columns) + ['distance', 'spm', 'workoutid']
|
||||||
columns = [x for x in columns if x != 'None']
|
columns = [x for x in columns if x != 'None']
|
||||||
columns = list(set(columns))
|
columns = list(set(columns))
|
||||||
|
|||||||
@@ -94,7 +94,15 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if promember %}
|
||||||
|
{% for key, value in extrametrics.items %}
|
||||||
|
<a class="button orange small" href="/rowers/workout/{{ id }}/flexchart/{{ xparam }}/{{ key }}/{{ yparam2 }}/{{ plottype }}">{{ value }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{% for key, value in extrametrics.items %}
|
||||||
|
<a class="button rosy small" href="/rowers/promembership">{{ value }} (Pro)</a>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -119,6 +127,15 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if promember %}
|
||||||
|
{% for key, value in extrametrics.items %}
|
||||||
|
<a class="button orange small" href="/rowers/workout/{{ id }}/flexchart/{{ xparam }}/{{ yparam1 }}/{{ key }}/{{ plottype }}">{{ value }}</a>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
{% for key, value in extrametrics.items %}
|
||||||
|
<a class="button rosy small" href="/rowers/promembership">{{ value }} (Pro)</a>
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -363,12 +363,12 @@ urlpatterns = [
|
|||||||
url(r'^register/thankyou/$', TemplateView.as_view(template_name='registerthankyou.html'), name='registerthankyou'),
|
url(r'^register/thankyou/$', TemplateView.as_view(template_name='registerthankyou.html'), name='registerthankyou'),
|
||||||
url(r'^workout/(?P<id>\d+)/workflow$',views.workout_workflow_view,
|
url(r'^workout/(?P<id>\d+)/workflow$',views.workout_workflow_view,
|
||||||
name='workout_workflow_view'),
|
name='workout_workflow_view'),
|
||||||
url(r'^workout/(?P<id>\d+)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/(?P<plottype>\w+)/$',views.workout_flexchart3_view),
|
url(r'^workout/(?P<id>\d+)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>[\w\ ]+.*)/(?P<yparam2>[\w\ ]+.*)/(?P<plottype>\w+)/$',views.workout_flexchart3_view),
|
||||||
url(r'^workout/(?P<id>\d+)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)/(?P<plottype>\w+.*)$',views.workout_flexchart3_view),
|
url(r'^workout/(?P<id>\d+)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>[\w\ ]+.*)/(?P<yparam2>[\w\ ]+.*)/(?P<plottype>\w+.*)$',views.workout_flexchart3_view),
|
||||||
url(r'^workout/(?P<id>\d+)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>\w+.*)/(?P<yparam2>\w+.*)$',views.workout_flexchart3_view),
|
url(r'^workout/(?P<id>\d+)/flexchart/(?P<xparam>\w+.*)/(?P<yparam1>[\w\ ]+.*)/(?P<yparam2>[\w\ ]+.*)$',views.workout_flexchart3_view),
|
||||||
url(r'^workout/(?P<id>\d+)/flexchart$',views.workout_flexchart3_view),
|
url(r'^workout/(?P<id>\d+)/flexchart$',views.workout_flexchart3_view),
|
||||||
url(r'^workout/compare/(?P<id1>\d+)/(?P<id2>\d+)/(?P<xparam>\w+.*)/(?P<yparam>\w+.*)/(?P<plottype>\w+.*)$',views.workout_comparison_view2),
|
url(r'^workout/compare/(?P<id1>\d+)/(?P<id2>\d+)/(?P<xparam>\w+.*)/(?P<yparam>[\w\ ]+.*)/(?P<plottype>[\w\ ]+.*)$',views.workout_comparison_view2),
|
||||||
url(r'^workout/compare/(?P<id1>\d+)/(?P<id2>\d+)/(?P<xparam>\w+.*)/(?P<yparam>\w+.*)/$',views.workout_comparison_view2),
|
url(r'^workout/compare/(?P<id1>\d+)/(?P<id2>\d+)/(?P<xparam>\w+.*)/(?P<yparam>[\w\ ]+.*)/$',views.workout_comparison_view2),
|
||||||
url(r'^test\_callback',views.rower_process_testcallback),
|
url(r'^test\_callback',views.rower_process_testcallback),
|
||||||
url(r'^workout/(?P<id>\d+)/test\_strokedata$',views.strokedataform),
|
url(r'^workout/(?P<id>\d+)/test\_strokedata$',views.strokedataform),
|
||||||
]
|
]
|
||||||
|
|||||||
108
rowers/views.py
108
rowers/views.py
@@ -6455,7 +6455,10 @@ def instroke_view(request,id=0):
|
|||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
rowdata = rrdata(csvfile=row.csvfilename)
|
rowdata = rrdata(csvfile=row.csvfilename)
|
||||||
instrokemetrics = rowdata.get_instroke_columns()
|
try:
|
||||||
|
instrokemetrics = rowdata.get_instroke_columns()
|
||||||
|
except AttributeError:
|
||||||
|
instrokemetrics = []
|
||||||
|
|
||||||
|
|
||||||
return render(request,
|
return render(request,
|
||||||
@@ -7491,7 +7494,12 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
|||||||
if yparam2 == name:
|
if yparam2 == name:
|
||||||
yparam2 = 'spm'
|
yparam2 = 'spm'
|
||||||
messages.info(request,'To use '+d['verbose_name']+', you have to be Pro member')
|
messages.info(request,'To use '+d['verbose_name']+', you have to be Pro member')
|
||||||
|
|
||||||
|
# bring back slashes
|
||||||
|
yparam1 = yparam1.replace('_slsh_','/')
|
||||||
|
yparam2 = yparam2.replace('_slsh_','/')
|
||||||
|
xparam = xparam.replace('_slsh_','/')
|
||||||
|
|
||||||
# create interactive plot
|
# create interactive plot
|
||||||
try:
|
try:
|
||||||
script,div,js_resources,css_resources,workstrokesonly = interactive_flex_chart2(id,xparam=xparam,yparam1=yparam1,
|
script,div,js_resources,css_resources,workstrokesonly = interactive_flex_chart2(id,xparam=xparam,yparam1=yparam1,
|
||||||
@@ -7517,55 +7525,61 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
|||||||
if d['mode'] == 'erg':
|
if d['mode'] == 'erg':
|
||||||
axchoicespro.pop(name)
|
axchoicespro.pop(name)
|
||||||
|
|
||||||
return render(request,
|
|
||||||
'flexchart3otw.html',
|
|
||||||
{'the_script':script,
|
|
||||||
'the_div':div,
|
|
||||||
'js_res': js_resources,
|
|
||||||
'css_res':css_resources,
|
|
||||||
'id':int(id),
|
|
||||||
'teams':get_my_teams(request.user),
|
|
||||||
'xparam':xparam,
|
|
||||||
'yparam1':yparam1,
|
|
||||||
'yparam2':yparam2,
|
|
||||||
'plottype':plottype,
|
|
||||||
'favoritechartnotes':favoritechartnotes,
|
|
||||||
'mayedit':mayedit,
|
|
||||||
'promember':promember,
|
|
||||||
'axchoicesbasic':axchoicesbasic,
|
|
||||||
'axchoicespro':axchoicespro,
|
|
||||||
'noylist':noylist,
|
|
||||||
'workstrokesonly': not workstrokesonly,
|
|
||||||
'favoritenr':favoritenr,
|
|
||||||
'maxfav':maxfav,
|
|
||||||
})
|
|
||||||
else:
|
else:
|
||||||
for name,d in rowingmetrics:
|
for name,d in rowingmetrics:
|
||||||
if d['mode'] == 'water':
|
if d['mode'] == 'water':
|
||||||
axchoicespro.pop(name)
|
axchoicespro.pop(name)
|
||||||
|
|
||||||
return render(request,
|
|
||||||
'flexchart3otw.html',
|
rowdata = rdata(row.csvfilename)
|
||||||
{'the_script':script,
|
additionalmetrics = rowdata.get_additional_metrics()
|
||||||
'the_div':div,
|
|
||||||
'js_res': js_resources,
|
|
||||||
'css_res':css_resources,
|
extrametrics = {m.replace('/','_slsh_'):m for m in additionalmetrics}
|
||||||
'teams':get_my_teams(request.user),
|
|
||||||
'id':int(id),
|
try:
|
||||||
'xparam':xparam,
|
extrametrics.pop('originalvelo')
|
||||||
'yparam1':yparam1,
|
except KeyError:
|
||||||
'yparam2':yparam2,
|
pass
|
||||||
'plottype':plottype,
|
|
||||||
'axchoicesbasic':axchoicesbasic,
|
try:
|
||||||
'axchoicespro':axchoicespro,
|
extrametrics.pop('cumdist')
|
||||||
'favoritechartnotes':favoritechartnotes,
|
except KeyError:
|
||||||
'noylist':noylist,
|
pass
|
||||||
'mayedit':mayedit,
|
|
||||||
'promember':promember,
|
try:
|
||||||
'workstrokesonly': not workstrokesonly,
|
extrametrics.pop(' Cadence (strokes_slsh_min)')
|
||||||
'favoritenr':favoritenr,
|
except KeyError:
|
||||||
'maxfav':maxfav,
|
pass
|
||||||
})
|
|
||||||
|
try:
|
||||||
|
extrametrics.pop(' WorkPerStroke (joules)')
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return render(request,
|
||||||
|
'flexchart3otw.html',
|
||||||
|
{'the_script':script,
|
||||||
|
'the_div':div,
|
||||||
|
'js_res': js_resources,
|
||||||
|
'css_res':css_resources,
|
||||||
|
'teams':get_my_teams(request.user),
|
||||||
|
'id':int(id),
|
||||||
|
'xparam':xparam,
|
||||||
|
'yparam1':yparam1,
|
||||||
|
'yparam2':yparam2,
|
||||||
|
'plottype':plottype,
|
||||||
|
'axchoicesbasic':axchoicesbasic,
|
||||||
|
'axchoicespro':axchoicespro,
|
||||||
|
'extrametrics':extrametrics,
|
||||||
|
'favoritechartnotes':favoritechartnotes,
|
||||||
|
'noylist':noylist,
|
||||||
|
'mayedit':mayedit,
|
||||||
|
'promember':promember,
|
||||||
|
'workstrokesonly': not workstrokesonly,
|
||||||
|
'favoritenr':favoritenr,
|
||||||
|
'maxfav':maxfav,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
# The interactive plot with the colored Heart rate zones
|
# The interactive plot with the colored Heart rate zones
|
||||||
|
|||||||
Reference in New Issue
Block a user