Private
Public Access
1
0

Merge branch 'release/v6.79'

This commit is contained in:
Sander Roosendaal
2018-06-01 17:11:25 +02:00
7 changed files with 50 additions and 6 deletions
+8 -1
View File
@@ -821,6 +821,7 @@ from utils import totaltime_sec_to_string
# Processes painsled CSV file to database # Processes painsled CSV file to database
def save_workout_database(f2, r, dosmooth=True, workouttype='rower', def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
boattype='1x',
dosummary=True, title='Workout', dosummary=True, title='Workout',
workoutsource='unknown', workoutsource='unknown',
notes='', totaldist=0, totaltime=0, notes='', totaldist=0, totaltime=0,
@@ -854,7 +855,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
except: except:
pass pass
return new_workout_from_df(r, newdf, return new_workout_from_df(r, newdf,
title=title) title=title,boattype=boattype)
try: try:
checks = row.check_consistency() checks = row.check_consistency()
allchecks = 1 allchecks = 1
@@ -1001,6 +1002,7 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
w = Workout(user=r, name=title, date=workoutdate, w = Workout(user=r, name=title, date=workoutdate,
workouttype=workouttype, workouttype=workouttype,
boattype=boattype,
duration=duration, distance=totaldist, duration=duration, distance=totaldist,
weightcategory=r.weightcategory, weightcategory=r.weightcategory,
starttime=workoutstarttime, starttime=workoutstarttime,
@@ -1229,6 +1231,7 @@ def handle_nonpainsled(f2, fileformat, summary=''):
def new_workout_from_file(r, f2, def new_workout_from_file(r, f2,
workouttype='rower', workouttype='rower',
title='Workout', title='Workout',
boattype='1x',
makeprivate=False, makeprivate=False,
notes=''): notes=''):
message = None message = None
@@ -1325,6 +1328,7 @@ def new_workout_from_file(r, f2,
id, message = save_workout_database( id, message = save_workout_database(
f2, r, f2, r,
workouttype=workouttype, workouttype=workouttype,
boattype=boattype,
makeprivate=makeprivate, makeprivate=makeprivate,
dosummary=dosummary, dosummary=dosummary,
workoutsource=fileformat, workoutsource=fileformat,
@@ -1438,6 +1442,7 @@ def split_workout(r, parent, splitsecond, splitmode):
def new_workout_from_df(r, df, def new_workout_from_df(r, df,
title='New Workout', title='New Workout',
boattype='1x',
parent=None, parent=None,
setprivate=False, setprivate=False,
forceunit='lbs', forceunit='lbs',
@@ -1450,6 +1455,7 @@ def new_workout_from_df(r, df,
oarlength = parent.oarlength oarlength = parent.oarlength
inboard = parent.inboard inboard = parent.inboard
workouttype = parent.workouttype workouttype = parent.workouttype
boattype = parent.boattype
notes = parent.notes notes = parent.notes
summary = parent.summary summary = parent.summary
if parent.privacy == 'hidden': if parent.privacy == 'hidden':
@@ -1494,6 +1500,7 @@ def new_workout_from_df(r, df,
id, message = save_workout_database(csvfilename, r, id, message = save_workout_database(csvfilename, r,
workouttype=workouttype, workouttype=workouttype,
boattype=boattype,
title=title, title=title,
notes=notes, notes=notes,
oarlength=oarlength, oarlength=oarlength,
+7 -2
View File
@@ -78,14 +78,19 @@ class DocumentsForm(forms.Form):
workouttype = forms.ChoiceField(required=True, workouttype = forms.ChoiceField(required=True,
choices=Workout.workouttypes) choices=Workout.workouttypes)
# initial='rower')
boattype = forms.ChoiceField(required=True,
choices=types.boattypes,
label = "Boat Type")
notes = forms.CharField(required=False, notes = forms.CharField(required=False,
widget=forms.Textarea) widget=forms.Textarea)
offline = forms.BooleanField(initial=False,required=False, offline = forms.BooleanField(initial=False,required=False,
label='Process in Background') label='Process in Background')
class Meta: class Meta:
fields = ['title','file','workouttype','fileformat','offline'] fields = ['title','file','workouttype','boattype','fileformat','offline']
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
from django.forms.widgets import HiddenInput from django.forms.widgets import HiddenInput
+1 -1
View File
@@ -448,7 +448,7 @@ def long_test_task2(self,aantal,**kwargs):
@app.task @app.task
def handle_new_workout_from_file(r, f2, def handle_new_workout_from_file(r, f2,
workouttype='rower', workouttype='rower',
title='Workout', boattype='1x',
makeprivate=False, makeprivate=False,
notes='',debug=False): notes='',debug=False):
return new_workout_from_file(r, f2, workouttype, return new_workout_from_file(r, f2, workouttype,
-1
View File
@@ -134,7 +134,6 @@
var data = new FormData(frm[0]); var data = new FormData(frm[0]);
$('#id_file').on('change', function(evt) { $('#id_file').on('change', function(evt) {
var f = this.files[0]; var f = this.files[0];
console.log(f); console.log(f);
+1 -1
View File
@@ -170,7 +170,7 @@
<td>{{ record.boattype }}</td> <td>{{ record.boattype }}</td>
<td>{{ record.age }}</td> <td>{{ record.age }}</td>
<td>{{ record.weightcategory }}</td> <td>{{ record.weightcategory }}</td>
{% if record.userid == rower.id %} {% if record.userid == rower.id and 'withdrawbutton' in buttons %}
<td> <td>
<a href="/rowers/virtualevent/{{ race.id }}/withdraw/{{ record.id }}" >Withdraw</a> <a href="/rowers/virtualevent/{{ race.id }}/withdraw/{{ record.id }}" >Withdraw</a>
</td> </td>
+21
View File
@@ -546,6 +546,7 @@ class DataTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'water', 'workouttype':'water',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
} }
@@ -640,6 +641,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -709,6 +711,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -750,6 +753,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'', 'title':'',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -781,6 +785,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'', 'title':'',
'workouttype':'rower', 'workouttype':'rower',
'boattype': '1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -813,6 +818,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'water', 'workouttype':'water',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -856,6 +862,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'water', 'workouttype':'water',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -886,6 +893,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'water', 'workouttype':'water',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -918,6 +926,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'water', 'workouttype':'water',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -948,6 +957,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'water', 'workouttype':'water',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -979,6 +989,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'water', 'workouttype':'water',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -1010,6 +1021,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'water', 'workouttype':'water',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -1039,6 +1051,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'water', 'workouttype':'water',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -1066,6 +1079,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -1093,6 +1107,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -1120,6 +1135,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -1148,6 +1164,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -1175,6 +1192,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -1202,6 +1220,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -1229,6 +1248,7 @@ class ViewTest(TestCase):
form_data = { form_data = {
'title':'test', 'title':'test',
'workouttype':'rower', 'workouttype':'rower',
'boattype':'1x',
'notes':'aap noot mies', 'notes':'aap noot mies',
'make_plot':False, 'make_plot':False,
'upload_to_c2':False, 'upload_to_c2':False,
@@ -1259,6 +1279,7 @@ class ViewTest(TestCase):
# form_data = { # form_data = {
# 'title':'test', # 'title':'test',
# 'workouttype':'water', # 'workouttype':'water',
# 'boattype':'1x',
# 'notes':'aap noot mies', # 'notes':'aap noot mies',
# 'make_plot':False, # 'make_plot':False,
# 'upload_to_c2':False, # 'upload_to_c2':False,
+12
View File
@@ -10150,6 +10150,11 @@ def workout_upload_view(request,
except KeyError: except KeyError:
workouttype = 'rower' workouttype = 'rower'
try:
boattype = docformoptions['boattype']
except KeyError:
boattype = '1x'
try: try:
plottype = uploadoptions['plottype'] plottype = uploadoptions['plottype']
except KeyError: except KeyError:
@@ -10213,8 +10218,11 @@ def workout_upload_view(request,
t = form.cleaned_data['title'] t = form.cleaned_data['title']
workouttype = form.cleaned_data['workouttype'] workouttype = form.cleaned_data['workouttype']
boattype = form.cleaned_data['boattype']
request.session['docformoptions'] = { request.session['docformoptions'] = {
'workouttype':workouttype, 'workouttype':workouttype,
'boattype': boattype,
} }
notes = form.cleaned_data['notes'] notes = form.cleaned_data['notes']
@@ -10243,6 +10251,8 @@ def workout_upload_view(request,
'upload_to_MapMyFitness':upload_to_ua, 'upload_to_MapMyFitness':upload_to_ua,
'upload_to_TrainingPeaks':upload_to_tp, 'upload_to_TrainingPeaks':upload_to_tp,
'landingpage':landingpage, 'landingpage':landingpage,
'boattype': boattype,
'workouttype': workouttype,
} }
@@ -10255,6 +10265,7 @@ def workout_upload_view(request,
id,message,f2 = dataprep.new_workout_from_file( id,message,f2 = dataprep.new_workout_from_file(
r,f2, r,f2,
workouttype=workouttype, workouttype=workouttype,
boattype=boattype,
makeprivate=makeprivate, makeprivate=makeprivate,
title = t, title = t,
notes='' notes=''
@@ -10529,6 +10540,7 @@ def team_workout_upload_view(request,message="",
id,message,f2 = dataprep.new_workout_from_file( id,message,f2 = dataprep.new_workout_from_file(
r,f2, r,f2,
workouttype=workouttype, workouttype=workouttype,
boattype=boattype,
makeprivate=False, makeprivate=False,
title = t, title = t,
notes='' notes=''