From e24dd0742679880062e184e0c4c272e6a698fcdf Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sat, 14 Dec 2019 14:34:58 +0100 Subject: [PATCH 1/3] bug fix --- rowers/views/workoutviews.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index 457c6260..befac25e 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -5171,12 +5171,11 @@ def workout_split_view(request,id=0): ids,mesgs = dataprep.split_workout( r,row,splitsecond,splitmode ) + for message in mesgs: + messages.info(request,message) except IndexError: messages.error(request,"Something went wrong in Split") - for message in mesgs: - messages.info(request,message) - if request.user == r: url = reverse('workouts_view') From d92e1968e8ada3730d2a801ed5a89306eff70e0b Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sat, 14 Dec 2019 15:31:48 +0100 Subject: [PATCH 2/3] adding json rigging files --- static/rigging/1x.json | 1 + static/rigging/2-.json | 1 + static/rigging/2x.json | 1 + static/rigging/4-.json | 1 + static/rigging/4x.json | 1 + static/rigging/8+.json | 1 + 6 files changed, 6 insertions(+) create mode 100644 static/rigging/1x.json create mode 100644 static/rigging/2-.json create mode 100644 static/rigging/2x.json create mode 100644 static/rigging/4-.json create mode 100644 static/rigging/4x.json create mode 100644 static/rigging/8+.json diff --git a/static/rigging/1x.json b/static/rigging/1x.json new file mode 100644 index 00000000..641e5c61 --- /dev/null +++ b/static/rigging/1x.json @@ -0,0 +1 @@ +{"Lin":0.9,"Mb":14,"BladeLength":0.46,"Lscull":2.425,"Nrowers":1,"RowOrScull":"scull","Span":1.6,"CatchAngle":-0.93,"DragForm":0.98} \ No newline at end of file diff --git a/static/rigging/2-.json b/static/rigging/2-.json new file mode 100644 index 00000000..33cfd7fa --- /dev/null +++ b/static/rigging/2-.json @@ -0,0 +1 @@ +{"Lin":1.14,"Mb":27,"BladeLength":0.46,"Lscull":2.975,"Nrowers":2,"RowOrScull":"row","Span":1.6,"CatchAngle":-0.93,"DragForm":1.05} \ No newline at end of file diff --git a/static/rigging/2x.json b/static/rigging/2x.json new file mode 100644 index 00000000..83211ac8 --- /dev/null +++ b/static/rigging/2x.json @@ -0,0 +1 @@ +{"Lin":0.9,"Mb":27,"BladeLength":0.46,"Lscull":2.425,"Nrowers":2,"RowOrScull":"scull","Span":1.6,"CatchAngle":-0.93,"DragForm":1.05} \ No newline at end of file diff --git a/static/rigging/4-.json b/static/rigging/4-.json new file mode 100644 index 00000000..ad6fbc92 --- /dev/null +++ b/static/rigging/4-.json @@ -0,0 +1 @@ +{"Lin":1.14,"Mb":50,"BladeLength":0.545,"Lscull":2.9325,"Nrowers":4,"RowOrScull":"row","Span":1.6,"CatchAngle":-0.93,"DragForm":1} \ No newline at end of file diff --git a/static/rigging/4x.json b/static/rigging/4x.json new file mode 100644 index 00000000..77355836 --- /dev/null +++ b/static/rigging/4x.json @@ -0,0 +1 @@ +{"Lin":0.9,"Mb":52,"BladeLength":0.46,"Lscull":2.425,"Nrowers":4,"RowOrScull":"scull","Span":1.6,"CatchAngle":-0.93,"DragForm":1.11} \ No newline at end of file diff --git a/static/rigging/8+.json b/static/rigging/8+.json new file mode 100644 index 00000000..45eafb0f --- /dev/null +++ b/static/rigging/8+.json @@ -0,0 +1 @@ +{"Lin":1.14,"Mb":151,"BladeLength":0.545,"Lscull":2.9325,"Nrowers":8,"RowOrScull":"row","Span":1.6,"CatchAngle":-0.93,"DragForm":1} \ No newline at end of file From 8e8211a8a6bb5251b1ab6b09c0eb549a852ec7cc Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sun, 15 Dec 2019 10:50:30 +0100 Subject: [PATCH 3/3] Adding a notes field to the training plan --- rowers/models.py | 6 ++++-- rowers/templates/trainingplan.html | 11 ++++++++--- rowers/views/planviews.py | 4 +++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/rowers/models.py b/rowers/models.py index 20a4b588..dcd7df70 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -1398,6 +1398,7 @@ class TrainingPlan(models.Model): status = models.BooleanField(default=True,verbose_name='Active') target = models.ForeignKey(TrainingTarget,blank=True,null=True,on_delete=models.SET_NULL) startdate = models.DateField(default=current_day) + notes = models.CharField(blank=True,null=True,max_length=200,verbose_name='Plan Notes') enddate = models.DateField( default=half_year_from_now) @@ -1476,11 +1477,12 @@ class TrainingPlan(models.Model): class TrainingPlanForm(ModelForm): class Meta: model = TrainingPlan - fields = ['name','target','startdate','enddate','status','rowers'] + fields = ['name','target','startdate','enddate','status','notes','rowers'] widgets = { 'startdate': AdminDateWidget(), - 'enddate': AdminDateWidget() + 'enddate': AdminDateWidget(), + 'notes': forms.Textarea() } def __init__(self,*args, **kwargs): diff --git a/rowers/templates/trainingplan.html b/rowers/templates/trainingplan.html index 1a8c8d8e..181f22cc 100644 --- a/rowers/templates/trainingplan.html +++ b/rowers/templates/trainingplan.html @@ -24,6 +24,11 @@ The training plan target is: {{ plan.target.name }} on {{ plan.target.date }}. {% endif %}

+ +

Notes

+

+ {{ plan.notes }} +

{% if plan|mayeditplan:request %}

Edit the plan

{% endif %} @@ -303,7 +308,7 @@ {% if todays_date <= microcycle.enddate %} - {% if microcycle.plan.type == 'userdefined' %} + {% if microcycle.plan.type == 'userdefined' %}   @@ -381,7 +386,7 @@ - {% if microcycle|mayeditplan:request %} + {% if microcycle|mayeditplan:request %} edit / delete @@ -427,7 +432,7 @@ The gray "filler" cycles are generated, adjusted and deleted automatically to ensure the entire plan - duration is covered with non-overlapping cycles. + duration is covered with non-overlapping cycles. Once you edit a filler cycle, it become a user-defined cycle, which cannot be deleted by the system.

diff --git a/rowers/views/planviews.py b/rowers/views/planviews.py index 2dcf28b9..c820b2ae 100644 --- a/rowers/views/planviews.py +++ b/rowers/views/planviews.py @@ -1557,7 +1557,7 @@ def plannedsession_totemplate_view(request,id=0): ps.enddate = datetime.date(1970,1,1) ps.save() - url = reverse(plannedsession_create_view,kwargs={'userid':request.user.id}) + url = reverse(plannedsession_create_view,kwargs={'userid':r.user.id}) startdatestring = startdate.strftime('%Y-%m-%d') enddatestring = enddate.strftime('%Y-%m-%d') @@ -2021,6 +2021,7 @@ def rower_create_trainingplan(request,userid=0): startdate = form.cleaned_data['startdate'] status = form.cleaned_data['status'] enddate = form.cleaned_data['enddate'] + notes = form.cleaned_data['notes'] try: athletes = form.cleaned_data['rowers'] @@ -2033,6 +2034,7 @@ def rower_create_trainingplan(request,userid=0): manager=themanager, startdate=startdate, enddate=enddate,status=status, + notes=notes, ) p.save()