links on analysis now to new analysis function
This commit is contained in:
@@ -14,9 +14,9 @@
|
||||
<li class="rounder">
|
||||
<h2>Compare Workouts</h2>
|
||||
{% if team %}
|
||||
<a href="/rowers/team-compare-select/team/{{ team.id }}/">
|
||||
<a href="/rowers/user-analysis-select/compare/team/{{ team.id }}/">
|
||||
{% else %}
|
||||
<a href="/rowers/team-compare-select/team/0/">
|
||||
<a href="/rowers/user-analysis-select/compare/team/0/">
|
||||
{% endif %}
|
||||
<div class="vignet">
|
||||
<img src="/static/img/workoutcompare.png"
|
||||
@@ -29,7 +29,7 @@
|
||||
</li>
|
||||
<li class="rounder">
|
||||
<h2>Stroke Analysis</h2>
|
||||
<a href="/rowers/flexall/">
|
||||
<a href="/rowers/user-analysis-select/flexall/">
|
||||
<div class="vignet">
|
||||
<img src="/static/img/strokeanalysis.png"
|
||||
alt="Stroke Analysis">
|
||||
@@ -41,7 +41,7 @@
|
||||
</li>
|
||||
<li class="rounder">
|
||||
<h2>Histogram</h2>
|
||||
<a href="/rowers/histo/">
|
||||
<a href="/rowers/user-analysis-select/histo/">
|
||||
<div class="vignet">
|
||||
<img src="/static/img/histogram.png" alt="Power Histogram">
|
||||
</div>
|
||||
@@ -52,7 +52,7 @@
|
||||
</li>
|
||||
<li class="rounder">
|
||||
<h2>Statistics</h2>
|
||||
<a href="/rowers/cumstats/">
|
||||
<a href="/rowers/user-analysis-select/stats/">
|
||||
<div class="vignet">
|
||||
<img src="/static/img/statistics.PNG" alt="Statistics">
|
||||
</div>
|
||||
@@ -63,7 +63,7 @@
|
||||
</li>
|
||||
<li class="rounder">
|
||||
<h2>Box Chart</h2>
|
||||
<a href="/rowers/user-boxplot-select/">
|
||||
<a href="/rowers/user-analysis-select/boxplot/">
|
||||
<div class="vignet">
|
||||
<img src="/static/img/boxplot.png" alt="Box Chart">
|
||||
</div>
|
||||
@@ -75,7 +75,7 @@
|
||||
</li>
|
||||
<li class="rounder">
|
||||
<h2>Trend Flex</h2>
|
||||
<a href="/rowers/user-multiflex-select/">
|
||||
<a href="/rowers/user-analysis-select/trendflex/">
|
||||
<div class="vignet">
|
||||
<img src="/static/img/trendflex.png" alt="Trend Flex">
|
||||
</div>
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
<ul>
|
||||
<li id="compare">
|
||||
{% if team %}
|
||||
<a href="/rowers/team-compare-select/team/{{ team.id }}/">
|
||||
<a href="/rowers/user-analysis-select/compare/team/{{ team.id }}/">
|
||||
<i class="fas fa-balance-scale fa-fw"></i> Compare
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="/rowers/team-compare-select/team/0/">
|
||||
<a href="/rowers/user-analysis-select/compare/team/0/">
|
||||
<i class="fas fa-balance-scale fa-fw"></i> Compare
|
||||
</a>
|
||||
{% endif %}
|
||||
@@ -48,29 +48,29 @@
|
||||
</label>
|
||||
<ul>
|
||||
<li id="stats-boxchart">
|
||||
<a href="/rowers/user-boxplot-select/">
|
||||
<a href="/rowers/user-analysis-select/boxplot/">
|
||||
<i class="fas fa-box-open fa-fw"></i> Box Chart
|
||||
</a>
|
||||
</li>
|
||||
<li id="stats-trendflex">
|
||||
<a href="/rowers/user-multiflex-select/">
|
||||
<a href="/rowers/user-analysis-select/trendflex/">
|
||||
<i class="far fa-chart-line fa-fw"></i> Trend Flex
|
||||
</a>
|
||||
</li>
|
||||
<li id="stats-cumstats">
|
||||
<a href="/rowers/cumstats/">
|
||||
<a href="/rowers/user-analysis-select/stats/">
|
||||
<i class="fal fa-table fa-fw"></i> Statistics
|
||||
</a>
|
||||
</li>
|
||||
<li id="stats-histo">
|
||||
<a href="/rowers/histo/">
|
||||
<a href="/rowers/user-analysis-select/histo/">
|
||||
<i class="fas fa-chart-bar"></i> Histogram
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/rowers/flexall/">
|
||||
<a href="/rowers/user-analysis-select/flexall/">
|
||||
<i class="fas fa-chart-line fa-fw"></i> Cumulative Flex Chart
|
||||
</a>
|
||||
</li>
|
||||
@@ -106,4 +106,29 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if user|user_teams %}
|
||||
<p> </p>
|
||||
<ul class="cd-accordion-menu animated">
|
||||
<li class="has-children" id="teams">
|
||||
<input type="checkbox" name="team-selector" id="team-selector">
|
||||
<label for="team-selector"><i class="fas fa-bullhorn fa-fw"></i> Groups</label>
|
||||
<ul>
|
||||
{% for tteam in teams %}
|
||||
<li>
|
||||
<a href={{ request.path|teamurl:tteam }}>
|
||||
<i class="fas fa-users fa-fw"></i>
|
||||
{% if tteam == team %}
|
||||
•
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
{{ tteam.name }}
|
||||
</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% include 'menuscript.html' %}
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
Binary file not shown.
@@ -224,8 +224,10 @@ urlpatterns = [
|
||||
re_path(r'^user-boxplot-select/user/(?P<userid>\d+)/$',views.user_boxplot_select,name='user_boxplot_select'),
|
||||
re_path(r'^user-boxplot-select/$',views.user_boxplot_select,name='user_boxplot_select'),
|
||||
re_path(r'^user-analysis-select/(?P<function>\w.*)/user/(?P<userid>\d+)/$',views.analysis_new,name='analysis_new'),
|
||||
re_path(r'^user-analysis-select/(?P<function>\w.*)/$',views.analysis_new,name='analysis_new'),
|
||||
re_path(r'^user-analysis-select/user/(?P<userid>\d+)/$',views.analysis_new,name='analysis_new'),
|
||||
re_path(r'^user-analysis-select/(?P<function>\w.*)/team/(?P<teamid>\d+)/$',views.analysis_new,name='analysis_new'),
|
||||
re_path(r'^user-analysis-select/team/(?P<teamid>\d+)/$',views.analysis_new,name='analysis_new'),
|
||||
re_path(r'^user-analysis-select/(?P<function>\w.*)/$',views.analysis_new,name='analysis_new'),
|
||||
re_path(r'^user-analysis-select/$',views.analysis_new,name='analysis_new'),
|
||||
# re_path(r'^user-multiflex-select/user/(?P<userid>\d+)/(?P<startdatestring>\d+-\d+-\d+)/(?P<enddatestring>\d+-\d+-\d+)/$',views.user_multiflex_select,name='user_multiflex_select'),
|
||||
re_path(r'^user-multiflex-select/user/(?P<userid>\d+)/$',views.user_multiflex_select,name='user_multiflex_select'),
|
||||
|
||||
@@ -16,7 +16,7 @@ env.filters['floatformat'] = floatformat
|
||||
|
||||
|
||||
from django.contrib.staticfiles import finders
|
||||
|
||||
from rowers.forms import analysischoices
|
||||
|
||||
# generic Analysis view -
|
||||
|
||||
@@ -32,11 +32,16 @@ defaultoptions = {
|
||||
@user_passes_test(ispromember, login_url="/rowers/paidplans",
|
||||
message="This functionality requires a Pro plan or higher",
|
||||
redirect_field_name=None)
|
||||
def analysis_new(request,userid=0,function='boxplot'):
|
||||
def analysis_new(request,userid=0,function='boxplot',teamid=0):
|
||||
r = getrequestrower(request, userid=userid)
|
||||
user = r.user
|
||||
userid = user.id
|
||||
|
||||
try:
|
||||
theteam = Team.objects.get(id=teamid)
|
||||
except Team.DoesNotExist:
|
||||
theteam = None
|
||||
|
||||
|
||||
if 'options' in request.session:
|
||||
options = request.session['options']
|
||||
@@ -64,7 +69,8 @@ def analysis_new(request,userid=0,function='boxplot'):
|
||||
else:
|
||||
startdate=timezone.now()-datetime.timedelta(days=42)
|
||||
|
||||
|
||||
if function not in [c[0] for c in analysischoices]:
|
||||
function = 'boxplot'
|
||||
|
||||
if 'enddate' in request.session:
|
||||
enddate = iso8601.parse_date(request.session['enddate'])
|
||||
@@ -162,14 +168,29 @@ def analysis_new(request,userid=0,function='boxplot'):
|
||||
if b[0] not in waterboattype:
|
||||
negtypes.append(b[0])
|
||||
|
||||
if theteam is not None and (theteam.viewing == 'allmembers' or theteam.manager == request.user):
|
||||
workouts = Workout.objects.filter(team=theteam,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities,
|
||||
)
|
||||
elif theteam is not None and theteam.viewing == 'coachonly':
|
||||
workouts = Workout.objects.filter(team=theteam,user=r,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities,
|
||||
)
|
||||
else:
|
||||
workouts = Workout.objects.filter(user=r,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities,
|
||||
)
|
||||
|
||||
workouts = Workout.objects.filter(user=r,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities,
|
||||
).order_by(
|
||||
workouts = workouts.order_by(
|
||||
"-date", "-starttime"
|
||||
).exclude(boattype__in=negtypes)
|
||||
|
||||
if rankingonly:
|
||||
workouts = workouts.exclude(rankingpiece=False)
|
||||
|
||||
@@ -188,13 +209,14 @@ def analysis_new(request,userid=0,function='boxplot'):
|
||||
|
||||
if request.method != 'POST':
|
||||
form = WorkoutMultipleCompareForm()
|
||||
chartform = AnalysisChoiceForm()
|
||||
chartform = AnalysisChoiceForm(initial={'function':function})
|
||||
selectedworkouts = Workout.objects.none()
|
||||
else:
|
||||
selectedworkouts = Workout.objects.filter(id__in=ids)
|
||||
|
||||
form.fields["workouts"].queryset = workouts | selectedworkouts
|
||||
|
||||
print(function,'aap')
|
||||
|
||||
optionsform = AnalysisOptionsForm(initial={
|
||||
'modality':modality,
|
||||
|
||||
Reference in New Issue
Block a user