Merge branch 'feature/trendflexmultimodal' into develop
This commit is contained in:
+1
-1
@@ -21,7 +21,7 @@ class UserAdmin(UserAdmin):
|
||||
inlines = (RowerInline,)
|
||||
|
||||
class WorkoutAdmin(admin.ModelAdmin):
|
||||
list_display = ('date','user','name','workouttype')
|
||||
list_display = ('date','user','name','workouttype','boattype')
|
||||
|
||||
class FavoriteChartAdmin(admin.ModelAdmin):
|
||||
list_display = ('user','xparam','yparam1','yparam2','plottype','workouttype','reststrokes')
|
||||
|
||||
+15
-22
@@ -8,7 +8,7 @@ from django.forms.extras.widgets import SelectDateWidget
|
||||
from django.utils import timezone,translation
|
||||
from django.forms import ModelForm
|
||||
import dataprep
|
||||
|
||||
import types
|
||||
import datetime
|
||||
|
||||
# login form
|
||||
@@ -45,18 +45,6 @@ class StrokeDataForm(forms.Form):
|
||||
|
||||
# The form used for uploading files
|
||||
class DocumentsForm(forms.Form):
|
||||
filetypechoices = (
|
||||
('csv' , 'Painsled iOS CSV'),
|
||||
('tcx' , 'TCX'),
|
||||
('tcxnohr' , 'TCX No HR'),
|
||||
('rp' , 'RowPro CSV'),
|
||||
('speedcoach' , 'SpeedCoach GPS CSV'),
|
||||
('speedcoach2' , 'SpeedCoach GPS 2 CSV'),
|
||||
('ergdata' , 'ErgData CSV'),
|
||||
('ergstick' , 'ErgStick CSV'),
|
||||
('painsleddesktop' , 'Painsled Desktop CSV'),
|
||||
('zip','Zipped file'),
|
||||
)
|
||||
title = forms.CharField(required=False)
|
||||
file = forms.FileField(required=True,
|
||||
validators=[validate_file_extension])
|
||||
@@ -275,15 +263,21 @@ class IntervalUpdateForm(forms.Form):
|
||||
self.fields['type_%s' % i].widget.attrs['style'] = 'width:156px; height: 22px;'
|
||||
self.fields['intervald_%s' % i].widget = forms.TimeInput(format='%H:%M:%S.%f')
|
||||
|
||||
boattypes = (
|
||||
('1x', '1x (single)'),
|
||||
('2x', '2x (double)'),
|
||||
('2-', '2- (pair)'),
|
||||
('4x', '4x (quad)'),
|
||||
('4-', '4- (four)'),
|
||||
('8+', '8+ (eight)'),
|
||||
)
|
||||
boattypes = types.boattypes
|
||||
workouttypes = types.workouttypes
|
||||
ww = list(workouttypes)
|
||||
ww.append(tuple(('all','All')))
|
||||
workouttypes = tuple(ww)
|
||||
|
||||
# form to select modality and boat type for trend flex
|
||||
class TrendFlexModalForm(forms.Form):
|
||||
modality = forms.ChoiceField(choices=workouttypes,
|
||||
label='Workout Type',
|
||||
initial='all')
|
||||
waterboattype = forms.MultipleChoiceField(choices=boattypes,
|
||||
label='Water Boat Type',
|
||||
initial = ['1x','2x','2-','4x','4-','8+'])
|
||||
|
||||
|
||||
# This form sets options for the summary stats page
|
||||
class StatsOptionsForm(forms.Form):
|
||||
@@ -342,7 +336,6 @@ formaxlabelsmultiflex['workoutid'] = 'Workout'
|
||||
parchoicesmultiflex = list(sorted(formaxlabelsmultiflex.items(), key = lambda x:x[1]))
|
||||
|
||||
from utils import palettes
|
||||
#palettechoices = { key:key for key, value in palettes.iteritems() }
|
||||
|
||||
palettechoices = tuple((p,p) for p in palettes.keys())
|
||||
|
||||
|
||||
+29
-57
@@ -22,6 +22,8 @@ import datetime
|
||||
from django.core.exceptions import ValidationError
|
||||
from rowers.rows import validate_file_extension
|
||||
|
||||
import types
|
||||
|
||||
from rowsandall_app.settings import (
|
||||
TWEET_ACCESS_TOKEN_KEY,
|
||||
TWEET_ACCESS_TOKEN_SECRET,
|
||||
@@ -353,53 +355,10 @@ def checkworkoutuser(user,workout):
|
||||
|
||||
# Workout
|
||||
class Workout(models.Model):
|
||||
workouttypes = (
|
||||
('water','On-water'),
|
||||
('rower','Indoor Rower'),
|
||||
('skierg','Ski Erg'),
|
||||
('dynamic','Dynamic Indoor Rower'),
|
||||
('slides','Indoor Rower on Slides'),
|
||||
('paddle','Paddle Adapter'),
|
||||
('snow','On-snow'),
|
||||
('coastal','Coastal'),
|
||||
('other','Other'),
|
||||
)
|
||||
|
||||
workoutsources = (
|
||||
('strava','strava'),
|
||||
('concept2','concept2'),
|
||||
('sporttracks','sporttracks'),
|
||||
('runkeeper','runkeeper'),
|
||||
('mapmyfitness','mapmyfitness'),
|
||||
('csv','painsled'),
|
||||
('tcx','tcx'),
|
||||
('rp','rp'),
|
||||
('mystery','mystery'),
|
||||
('tcxnohr','tcx (no HR)'),
|
||||
('rowperfect3','rowperfect3'),
|
||||
('ergdata','ergdata'),
|
||||
('boatcoach','boatcoach'),
|
||||
('bcmike','boatcoach (develop)'),
|
||||
('painsleddesktop','painsleddesktop'),
|
||||
('speedcoach','speedcoach'),
|
||||
('speedcoach2','speedcoach2'),
|
||||
('ergstick','ergstick'),
|
||||
('fit','fit'),
|
||||
('unknown','unknown'))
|
||||
|
||||
boattypes = (
|
||||
('1x', '1x (single)'),
|
||||
('2x', '2x (double)'),
|
||||
('2-', '2- (pair)'),
|
||||
('4x', '4x (quad)'),
|
||||
('4-', '4- (four)'),
|
||||
('8+', '8+ (eight)'),
|
||||
)
|
||||
|
||||
privacychoices = (
|
||||
('private','Private'),
|
||||
('visible','Visible'),
|
||||
)
|
||||
workouttypes = types.workouttypes
|
||||
workoutsources = types.workoutsources
|
||||
boattypes = types.boattypes
|
||||
privacychoices = types.privacychoices
|
||||
|
||||
user = models.ForeignKey(Rower)
|
||||
team = models.ManyToManyField(Team,blank=True)
|
||||
@@ -409,7 +368,7 @@ class Workout(models.Model):
|
||||
workoutsource = models.CharField(choices=workoutsources,max_length=100,
|
||||
default='unknown')
|
||||
boattype = models.CharField(choices=boattypes,max_length=50,
|
||||
default='1x (single)',
|
||||
default='1x',
|
||||
verbose_name = 'Boat Type')
|
||||
starttime = models.TimeField(blank=True,null=True)
|
||||
startdatetime = models.DateTimeField(blank=True,null=True)
|
||||
@@ -446,17 +405,30 @@ class Workout(models.Model):
|
||||
ownerfirst = self.user.user.first_name
|
||||
ownerlast = self.user.user.last_name
|
||||
duration = self.duration
|
||||
boattype = self.boattype
|
||||
workouttype = self.workouttype
|
||||
|
||||
stri = u'{d} {n} {dist}m {duration:%H:%M:%S} {workouttype} {ownerfirst} {ownerlast}'.format(
|
||||
d = date.strftime('%Y-%m-%d'),
|
||||
n = name,
|
||||
dist = distance,
|
||||
duration = duration,
|
||||
workouttype = workouttype,
|
||||
ownerfirst = ownerfirst,
|
||||
ownerlast = ownerlast,
|
||||
)
|
||||
if workouttype != 'water':
|
||||
stri = u'{d} {n} {dist}m {duration:%H:%M:%S} {workouttype} {ownerfirst} {ownerlast}'.format(
|
||||
d = date.strftime('%Y-%m-%d'),
|
||||
n = name,
|
||||
dist = distance,
|
||||
duration = duration,
|
||||
workouttype = workouttype,
|
||||
ownerfirst = ownerfirst,
|
||||
ownerlast = ownerlast,
|
||||
)
|
||||
else:
|
||||
stri = u'{d} {n} {dist}m {duration:%H:%M:%S} {workouttype} {boattype} {ownerfirst} {ownerlast}'.format(
|
||||
d = date.strftime('%Y-%m-%d'),
|
||||
n = name,
|
||||
dist = distance,
|
||||
duration = duration,
|
||||
workouttype = workouttype,
|
||||
boattype=boattype,
|
||||
ownerfirst = ownerfirst,
|
||||
ownerlast = ownerlast,
|
||||
)
|
||||
|
||||
return stri
|
||||
|
||||
|
||||
@@ -13,6 +13,55 @@
|
||||
checkboxes[i].checked = source.checked;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Get the form fields and hidden div
|
||||
var modality = $("#id_modality");
|
||||
var hidden = $("#id_waterboattype");
|
||||
|
||||
|
||||
// Hide the fields.
|
||||
// Use JS to do this in case the user doesn't have JS
|
||||
// enabled.
|
||||
|
||||
hidden.hide();
|
||||
|
||||
|
||||
|
||||
// Setup an event listener for when the state of the
|
||||
// checkbox changes.
|
||||
modality.change(function() {
|
||||
// Check to see if the checkbox is checked.
|
||||
// If it is, show the fields and populate the input.
|
||||
// If not, hide the fields.
|
||||
var Value = modality.val();
|
||||
if (Value=='water') {
|
||||
// Show the hidden fields.
|
||||
hidden.show();
|
||||
} else {
|
||||
// Make sure that the hidden fields are indeed
|
||||
// hidden.
|
||||
hidden.hide();
|
||||
|
||||
// You may also want to clear the value of the
|
||||
// hidden fields here. Just in case somebody
|
||||
// shows the fields, enters data to them and then
|
||||
// unticks the checkbox.
|
||||
//
|
||||
// This would do the job:
|
||||
//
|
||||
// $("#hidden_field").val("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -23,21 +72,38 @@
|
||||
<h3>{{ team.name }} Team Workouts</h3>
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
<div class="grid_4 alpha">
|
||||
<div class="grid_6 alpha">
|
||||
|
||||
{% if team %}
|
||||
<form enctype="multipart/form-data" action="/rowers/team-compare-select/team/{{ team.id }}/" method="post">
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" action="/rowers/team-compare-select/" method="post">
|
||||
{% endif %}
|
||||
|
||||
<div class="grid_4 alpha">
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
<input name='daterange' class="button green" type="submit" value="Submit">
|
||||
</div>
|
||||
<div class="grid_2">
|
||||
<input name='daterange' class="button green" type="submit" value="Submit"> </form>
|
||||
</form>
|
||||
{% if team %}
|
||||
<form enctype="multipart/form-data" action="/rowers/team-compare-select/team/{{ team.id }}/" method="post">
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" action="/rowers/team-compare-select/" method="post">
|
||||
{% endif %}
|
||||
<div class="grid_4 alpha">
|
||||
<table>
|
||||
{{ modalityform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
<input name='modalityform' class="button green" type="submit" value="Submit">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="grid_5 prefix_1 omega">
|
||||
{% if team %}
|
||||
|
||||
@@ -12,6 +12,55 @@
|
||||
checkboxes[i].checked = source.checked;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Get the form fields and hidden div
|
||||
var modality = $("#id_modality");
|
||||
var hidden = $("#id_waterboattype");
|
||||
|
||||
|
||||
// Hide the fields.
|
||||
// Use JS to do this in case the user doesn't have JS
|
||||
// enabled.
|
||||
|
||||
hidden.hide();
|
||||
|
||||
|
||||
|
||||
// Setup an event listener for when the state of the
|
||||
// checkbox changes.
|
||||
modality.change(function() {
|
||||
// Check to see if the checkbox is checked.
|
||||
// If it is, show the fields and populate the input.
|
||||
// If not, hide the fields.
|
||||
var Value = modality.val();
|
||||
if (Value=='water') {
|
||||
// Show the hidden fields.
|
||||
hidden.show();
|
||||
} else {
|
||||
// Make sure that the hidden fields are indeed
|
||||
// hidden.
|
||||
hidden.hide();
|
||||
|
||||
// You may also want to clear the value of the
|
||||
// hidden fields here. Just in case somebody
|
||||
// shows the fields, enters data to them and then
|
||||
// unticks the checkbox.
|
||||
//
|
||||
// This would do the job:
|
||||
//
|
||||
// $("#hidden_field").val("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -45,23 +94,42 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
<div class="grid_6 alpha">
|
||||
{% if theuser %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot-select/user/{{ theuser.id }}/" method="post">
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot-select/" method="post">
|
||||
{% endif %}
|
||||
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot-select/" method="post">
|
||||
{% endif %}
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
<input name='daterange' class="button green" type="submit" value="Submit">
|
||||
</div>
|
||||
</form>
|
||||
{% if theuser %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot-select/user/{{ theuser.id }}/" method="post">
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-boxplot-select/" method="post">
|
||||
{% endif %}
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
<table>
|
||||
{{ modalityform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
<input name='modalityform' class="button green" type="submit" value="Submit">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="grid_2">
|
||||
<input name='daterange' class="button green" type="submit" value="Submit"> </form>
|
||||
</div>
|
||||
<div class="grid_5 prefix_1 omega">
|
||||
|
||||
<div class="grid_5 prefix_1 omega">
|
||||
<form id="searchform" action=""
|
||||
method="get" accept-charset="utf-8">
|
||||
<div class="grid_3 prefix_1 alpha">
|
||||
|
||||
@@ -12,6 +12,55 @@
|
||||
checkboxes[i].checked = source.checked;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
|
||||
<script>
|
||||
$(function() {
|
||||
|
||||
// Get the form fields and hidden div
|
||||
var modality = $("#id_modality");
|
||||
var hidden = $("#id_waterboattype");
|
||||
|
||||
|
||||
// Hide the fields.
|
||||
// Use JS to do this in case the user doesn't have JS
|
||||
// enabled.
|
||||
|
||||
hidden.hide();
|
||||
|
||||
|
||||
|
||||
// Setup an event listener for when the state of the
|
||||
// checkbox changes.
|
||||
modality.change(function() {
|
||||
// Check to see if the checkbox is checked.
|
||||
// If it is, show the fields and populate the input.
|
||||
// If not, hide the fields.
|
||||
var Value = modality.val();
|
||||
if (Value=='water') {
|
||||
// Show the hidden fields.
|
||||
hidden.show();
|
||||
} else {
|
||||
// Make sure that the hidden fields are indeed
|
||||
// hidden.
|
||||
hidden.hide();
|
||||
|
||||
// You may also want to clear the value of the
|
||||
// hidden fields here. Just in case somebody
|
||||
// shows the fields, enters data to them and then
|
||||
// unticks the checkbox.
|
||||
//
|
||||
// This would do the job:
|
||||
//
|
||||
// $("#hidden_field").val("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@@ -45,22 +94,42 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid_12 alpha">
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
<div class="grid_6 alpha">
|
||||
{% if theuser %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/user/{{ theuser.id }}/" method="post">
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/" method="post">
|
||||
{% endif %}
|
||||
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
<div class="grid_2">
|
||||
<input name='daterange' class="button green" type="submit" value="Submit"> </form>
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/" method="post">
|
||||
{% endif %}
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
<input name='daterange' class="button green" type="submit" value="Submit">
|
||||
</div>
|
||||
</form>
|
||||
{% if theuser %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/user/{{ theuser.id }}/" method="post">
|
||||
{% else %}
|
||||
<form enctype="multipart/form-data" action="/rowers/user-multiflex-select/" method="post">
|
||||
{% endif %}
|
||||
<div class="grid_4 alpha">
|
||||
|
||||
<table>
|
||||
{{ modalityform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</div>
|
||||
<div class="grid_2 omega">
|
||||
<input name='modalityform' class="button green" type="submit" value="Submit">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="grid_5 prefix_1 omega">
|
||||
<form id="searchform" action=""
|
||||
method="get" accept-charset="utf-8">
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
workouttypes = (
|
||||
('water','On-water'),
|
||||
('rower','Indoor Rower'),
|
||||
('skierg','Ski Erg'),
|
||||
('dynamic','Dynamic Indoor Rower'),
|
||||
('slides','Indoor Rower on Slides'),
|
||||
('paddle','Paddle Adapter'),
|
||||
('snow','On-snow'),
|
||||
('coastal','Coastal'),
|
||||
('other','Other'),
|
||||
)
|
||||
|
||||
workoutsources = (
|
||||
('strava','strava'),
|
||||
('concept2','concept2'),
|
||||
('sporttracks','sporttracks'),
|
||||
('runkeeper','runkeeper'),
|
||||
('mapmyfitness','mapmyfitness'),
|
||||
('csv','painsled'),
|
||||
('tcx','tcx'),
|
||||
('rp','rp'),
|
||||
('mystery','mystery'),
|
||||
('tcxnohr','tcx (no HR)'),
|
||||
('rowperfect3','rowperfect3'),
|
||||
('ergdata','ergdata'),
|
||||
('boatcoach','boatcoach'),
|
||||
('bcmike','boatcoach (develop)'),
|
||||
('painsleddesktop','painsleddesktop'),
|
||||
('speedcoach','speedcoach'),
|
||||
('speedcoach2','speedcoach2'),
|
||||
('ergstick','ergstick'),
|
||||
('fit','fit'),
|
||||
('unknown','unknown'))
|
||||
|
||||
boattypes = (
|
||||
('1x', '1x (single)'),
|
||||
('2x', '2x (double)'),
|
||||
('2-', '2- (pair)'),
|
||||
('4x', '4x (quad)'),
|
||||
('4-', '4- (four)'),
|
||||
('8+', '8+ (eight)'),
|
||||
)
|
||||
|
||||
privacychoices = (
|
||||
('private','Private'),
|
||||
('visible','Visible'),
|
||||
)
|
||||
+165
-11
@@ -36,6 +36,7 @@ from rowers.forms import (
|
||||
RegistrationFormUniqueEmail,CNsummaryForm,UpdateWindForm,
|
||||
UpdateStreamForm,WorkoutMultipleCompareForm,ChartParamChoiceForm,
|
||||
FusionMetricChoiceForm,BoxPlotChoiceForm,MultiFlexChoiceForm,
|
||||
TrendFlexModalForm,
|
||||
)
|
||||
from rowers.models import Workout, User, Rower, WorkoutForm,FavoriteChart
|
||||
from rowers.models import (
|
||||
@@ -97,7 +98,7 @@ from scipy.signal import savgol_filter
|
||||
from django.shortcuts import render_to_response
|
||||
from Cookie import SimpleCookie
|
||||
from shutil import copyfile
|
||||
|
||||
import types
|
||||
from rowingdata import rower as rrower
|
||||
from rowingdata import main as rmain
|
||||
from rowingdata import rowingdata as rrdata
|
||||
@@ -3169,19 +3170,67 @@ def team_comparison_select(request,
|
||||
except Rower.DoesNotExist:
|
||||
raise Http404("Rower doesn't exist")
|
||||
|
||||
if 'startdate' in request.session:
|
||||
startdate = iso8601.parse_date(request.session['startdate'])
|
||||
|
||||
|
||||
if request.method == 'POST':
|
||||
|
||||
if 'enddate' in request.session:
|
||||
enddate = iso8601.parse_date(request.session['enddate'])
|
||||
|
||||
|
||||
if 'waterboattype' in request.session:
|
||||
waterboattype = request.session['waterboattype']
|
||||
else:
|
||||
waterboattype = ['1x','2x','2-','4x','4-','8+']
|
||||
|
||||
|
||||
if 'modalities' in request.session:
|
||||
modalities = request.session['modalities']
|
||||
if len(modalities) > 1:
|
||||
modality = 'all'
|
||||
else:
|
||||
modality = modalities[0]
|
||||
else:
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
|
||||
if request.method == 'POST' and 'daterange' in request.POST:
|
||||
dateform = DateRangeForm(request.POST)
|
||||
if dateform.is_valid():
|
||||
startdate = dateform.cleaned_data['startdate']
|
||||
enddate = dateform.cleaned_data['enddate']
|
||||
startdatestring = startdate.strftime('%Y-%m-%d')
|
||||
enddatestring = enddate.strftime('%Y-%m-%d')
|
||||
request.session['startdate'] = startdatestring
|
||||
request.session['enddate'] = enddatestring
|
||||
else:
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
})
|
||||
|
||||
|
||||
if request.method == 'POST' and 'modality' in request.POST:
|
||||
modalityform = TrendFlexModalForm(request.POST)
|
||||
if modalityform.is_valid():
|
||||
modality = modalityform.cleaned_data['modality']
|
||||
waterboattype = modalityform.cleaned_data['waterboattype']
|
||||
if modality == 'all':
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
else:
|
||||
modalities = [modality]
|
||||
|
||||
if modality != 'water':
|
||||
waterboattype = [b[0] for b in types.boattypes]
|
||||
|
||||
|
||||
request.session['modalities'] = modalities
|
||||
request.session['waterboattype'] = waterboattype
|
||||
|
||||
negtypes = []
|
||||
for b in types.boattypes:
|
||||
if b[0] not in waterboattype:
|
||||
negtypes.append(b[0])
|
||||
|
||||
startdate = datetime.datetime.combine(startdate,datetime.time())
|
||||
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
||||
enddate = enddate+datetime.timedelta(days=1)
|
||||
@@ -3207,18 +3256,21 @@ def team_comparison_select(request,
|
||||
if theteam and (theteam.viewing == 'allmembers' or theteam.manager == request.user):
|
||||
workouts = Workout.objects.filter(team=theteam,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate).order_by("-date", "-starttime")
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities).order_by("-date", "-starttime").exclude(boattype__in=negtypes)
|
||||
elif theteam and theteam.viewing == 'coachonly':
|
||||
workouts = Workout.objects.filter(team=theteam,user=r,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate).order_by("-date","-starttime")
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities).order_by("-date","-starttime").exclude(boattype__in=negtypes)
|
||||
|
||||
|
||||
else:
|
||||
theteam = None
|
||||
workouts = Workout.objects.filter(user=r,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate).order_by("-date", "-starttime")
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities).order_by("-date", "-starttime").exclude(boattype__in=negtypes)
|
||||
|
||||
query = request.GET.get('q')
|
||||
if query:
|
||||
@@ -3239,6 +3291,11 @@ def team_comparison_select(request,
|
||||
theid = 0
|
||||
|
||||
chartform = ChartParamChoiceForm(initial={'teamid':0})
|
||||
modalityform = TrendFlexModalForm(initial={
|
||||
'modality':modality,
|
||||
'waterboattype':waterboattype
|
||||
})
|
||||
|
||||
|
||||
messages.info(request,successmessage)
|
||||
messages.error(request,message)
|
||||
@@ -3251,6 +3308,7 @@ def team_comparison_select(request,
|
||||
'team':theteam,
|
||||
'form':form,
|
||||
'chartform':chartform,
|
||||
'modalityform':modalityform,
|
||||
'teams':get_my_teams(request.user),
|
||||
})
|
||||
|
||||
@@ -3374,6 +3432,7 @@ def user_multiflex_select(request,
|
||||
except:
|
||||
ploterrorbars = False
|
||||
|
||||
|
||||
|
||||
if 'startdate' in request.session:
|
||||
startdate = iso8601.parse_date(request.session['startdate'])
|
||||
@@ -3383,17 +3442,54 @@ def user_multiflex_select(request,
|
||||
enddate = iso8601.parse_date(request.session['enddate'])
|
||||
|
||||
|
||||
if request.method == 'POST':
|
||||
if 'waterboattype' in request.session:
|
||||
waterboattype = request.session['waterboattype']
|
||||
else:
|
||||
waterboattype = ['1x','2x','2-','4x','4-','8+']
|
||||
|
||||
|
||||
if 'modalities' in request.session:
|
||||
modalities = request.session['modalities']
|
||||
if len(modalities) > 1:
|
||||
modality = 'all'
|
||||
else:
|
||||
modality = modalities[0]
|
||||
else:
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
|
||||
if request.method == 'POST' and 'daterange' in request.POST:
|
||||
dateform = DateRangeForm(request.POST)
|
||||
if dateform.is_valid():
|
||||
startdate = dateform.cleaned_data['startdate']
|
||||
enddate = dateform.cleaned_data['enddate']
|
||||
startdatestring = startdate.strftime('%Y-%m-%d')
|
||||
enddatestring = enddate.strftime('%Y-%m-%d')
|
||||
request.session['startdate'] = startdatestring
|
||||
request.session['enddate'] = enddatestring
|
||||
else:
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
})
|
||||
|
||||
if request.method == 'POST' and 'modality' in request.POST:
|
||||
modalityform = TrendFlexModalForm(request.POST)
|
||||
if modalityform.is_valid():
|
||||
modality = modalityform.cleaned_data['modality']
|
||||
waterboattype = modalityform.cleaned_data['waterboattype']
|
||||
if modality == 'all':
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
else:
|
||||
modalities = [modality]
|
||||
|
||||
if modality != 'water':
|
||||
waterboattype = [b[0] for b in types.boattypes]
|
||||
|
||||
|
||||
request.session['modalities'] = modalities
|
||||
request.session['waterboattype'] = waterboattype
|
||||
|
||||
|
||||
startdate = datetime.datetime.combine(startdate,datetime.time())
|
||||
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
||||
enddate = enddate+datetime.timedelta(days=1)
|
||||
@@ -3409,9 +3505,15 @@ def user_multiflex_select(request,
|
||||
startdate = s
|
||||
|
||||
|
||||
negtypes = []
|
||||
for b in types.boattypes:
|
||||
if b[0] not in waterboattype:
|
||||
negtypes.append(b[0])
|
||||
|
||||
workouts = Workout.objects.filter(user=r,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate).order_by("-date", "-starttime")
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities).order_by("-date", "-starttime").exclude(boattype__in=negtypes)
|
||||
|
||||
query = request.GET.get('q')
|
||||
if query:
|
||||
@@ -3432,6 +3534,11 @@ def user_multiflex_select(request,
|
||||
'includereststrokes':includereststrokes,
|
||||
})
|
||||
|
||||
modalityform = TrendFlexModalForm(initial={
|
||||
'modality':modality,
|
||||
'waterboattype':waterboattype
|
||||
})
|
||||
|
||||
messages.info(request,successmessage)
|
||||
messages.error(request,message)
|
||||
|
||||
@@ -3448,6 +3555,7 @@ def user_multiflex_select(request,
|
||||
'theuser':user,
|
||||
'form':form,
|
||||
'chartform':chartform,
|
||||
'modalityform':modalityform,
|
||||
'teams':get_my_teams(request.user),
|
||||
})
|
||||
|
||||
@@ -3698,7 +3806,7 @@ def multiflex_view(request,userid=0,
|
||||
clegendy = df['groupval'].min()+clegendx*(df['groupval'].max()-df['groupval'].min())
|
||||
else:
|
||||
clegendy = df.index.min()+clegendx*(df.index.max()-df.index.min())
|
||||
print clegendy
|
||||
|
||||
|
||||
|
||||
colorlegend = zip(range(6),clegendy,legcolors)
|
||||
@@ -3757,17 +3865,53 @@ def user_boxplot_select(request,
|
||||
enddate = iso8601.parse_date(request.session['enddate'])
|
||||
|
||||
|
||||
if request.method == 'POST':
|
||||
if 'waterboattype' in request.session:
|
||||
waterboattype = request.session['waterboattype']
|
||||
else:
|
||||
waterboattype = ['1x','2x','2-','4x','4-','8+']
|
||||
|
||||
|
||||
if 'modalities' in request.session:
|
||||
modalities = request.session['modalities']
|
||||
if len(modalities) > 1:
|
||||
modality = 'all'
|
||||
else:
|
||||
modality = modalities[0]
|
||||
else:
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
|
||||
if request.method == 'POST' and 'daterange' in request.POST:
|
||||
dateform = DateRangeForm(request.POST)
|
||||
if dateform.is_valid():
|
||||
startdate = dateform.cleaned_data['startdate']
|
||||
enddate = dateform.cleaned_data['enddate']
|
||||
startdatestring = startdate.strftime('%Y-%m-%d')
|
||||
enddatestring = enddate.strftime('%Y-%m-%d')
|
||||
request.session['startdate'] = startdatestring
|
||||
request.session['enddate'] = enddatestring
|
||||
else:
|
||||
dateform = DateRangeForm(initial={
|
||||
'startdate':startdate,
|
||||
'enddate':enddate,
|
||||
})
|
||||
|
||||
if request.method == 'POST' and 'modality' in request.POST:
|
||||
modalityform = TrendFlexModalForm(request.POST)
|
||||
if modalityform.is_valid():
|
||||
modality = modalityform.cleaned_data['modality']
|
||||
waterboattype = modalityform.cleaned_data['waterboattype']
|
||||
if modality == 'all':
|
||||
modalities = [m[0] for m in types.workouttypes]
|
||||
else:
|
||||
modalities = [modality]
|
||||
|
||||
if modality != 'water':
|
||||
waterboattype = [b[0] for b in types.boattypes]
|
||||
|
||||
|
||||
request.session['modalities'] = modalities
|
||||
request.session['waterboattype'] = waterboattype
|
||||
|
||||
startdate = datetime.datetime.combine(startdate,datetime.time())
|
||||
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
||||
enddate = enddate+datetime.timedelta(days=1)
|
||||
@@ -3782,10 +3926,15 @@ def user_boxplot_select(request,
|
||||
enddate = startdate
|
||||
startdate = s
|
||||
|
||||
negtypes = []
|
||||
for b in types.boattypes:
|
||||
if b[0] not in waterboattype:
|
||||
negtypes.append(b[0])
|
||||
|
||||
workouts = Workout.objects.filter(user=r,
|
||||
startdatetime__gte=startdate,
|
||||
startdatetime__lte=enddate).order_by("-date", "-starttime")
|
||||
startdatetime__lte=enddate,
|
||||
workouttype__in=modalities).order_by("-date", "-starttime").exclude(boattype__in=negtypes)
|
||||
|
||||
query = request.GET.get('q')
|
||||
if query:
|
||||
@@ -3801,6 +3950,10 @@ def user_boxplot_select(request,
|
||||
form.fields["workouts"].queryset = workouts
|
||||
|
||||
chartform = BoxPlotChoiceForm()
|
||||
modalityform = TrendFlexModalForm(initial={
|
||||
'modality':modality,
|
||||
'waterboattype':waterboattype
|
||||
})
|
||||
|
||||
messages.info(request,successmessage)
|
||||
messages.error(request,message)
|
||||
@@ -3818,6 +3971,7 @@ def user_boxplot_select(request,
|
||||
'theuser':user,
|
||||
'form':form,
|
||||
'chartform':chartform,
|
||||
'modalityform':modalityform,
|
||||
'teams':get_my_teams(request.user),
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user