diff --git a/rowers/models.py b/rowers/models.py index 4d968e96..880efd19 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -751,11 +751,14 @@ parchoicesx = list(sorted(favchartlabelsx.items(), key = lambda x:x[1])) # Saving a chart as a favorite chart class FavoriteChart(models.Model): - workouttypechoices = ( + workouttypechoices = [ ('ote','Erg/SkiErg'), ('otw','On The Water'), - ('both','both') - ) + ('all','All') + ] + + for workoutsource in mytypes.workoutsources: + workouttypechoices.append(workoutsource) plottypes = ( ('line','Line Chart'), @@ -771,6 +774,7 @@ class FavoriteChart(models.Model): workouttype = models.CharField(max_length=50,choices=workouttypechoices, default='both', verbose_name='Workout Type') + reststrokes = models.BooleanField(default=True,verbose_name="Incl. Rest") notes = models.CharField(max_length=300,verbose_name='Chart Notes', default='Flex Chart Notes',blank=True) diff --git a/rowers/mytypes.py b/rowers/mytypes.py index c6a2165c..df0709ba 100644 --- a/rowers/mytypes.py +++ b/rowers/mytypes.py @@ -30,14 +30,14 @@ workoutsources = ( ('mapmyfitness','mapmyfitness'), ('csv','painsled'), ('tcx','tcx'), - ('rp','rp'), + ('rp','rowperfect'), ('mystery','mystery'), - ('tcxnohr','tcx (no HR)'), +# ('tcxnohr','tcx (no HR)'), ('rowperfect3','rowperfect3'), ('ergdata','ergdata'), ('boatcoach','boatcoach'), ('boatcoachotw','boatcoachotw'), - ('bcmike','boatcoach (develop)'), +# ('bcmike','boatcoach (develop)'), ('painsleddesktop','painsleddesktop'), ('speedcoach','speedcoach'), ('speedcoach2','speedcoach2'), @@ -52,6 +52,7 @@ boattypes = ( ('2-', '2- (pair)'), ('2+', '2+ (coxed pair)'), ('3x+','3x+ (coxed triple)'), + ('3x-','3x- (triple)'), ('4x', '4x (quad)'), ('4x+', '4x+ (coxed quad)'), ('4-', '4- (four)'), diff --git a/rowers/templates/workout_form.html b/rowers/templates/workout_form.html index 026721ab..72a8a0fe 100644 --- a/rowers/templates/workout_form.html +++ b/rowers/templates/workout_form.html @@ -74,7 +74,9 @@ $('#id_workouttype').change(); Duration:{{ workout.duration |durationprint:"%H:%M:%S.%f" }} - Public link to this workout + Source:{{ workout.workoutsource }} + + Public link to this workout: https://rowsandall.com/rowers/workout/{{ workout.id }} diff --git a/rowers/uploads.py b/rowers/uploads.py index 676e481c..cce0324a 100644 --- a/rowers/uploads.py +++ b/rowers/uploads.py @@ -26,7 +26,7 @@ queue = django_rq.get_queue('default') queuelow = django_rq.get_queue('low') queuehigh = django_rq.get_queue('low') -from mytypes import workouttypes,boattypes,otwtypes +from mytypes import workouttypes,boattypes,otwtypes,workoutsources try: from cStringIO import StringIO diff --git a/rowers/views.py b/rowers/views.py index f0cda92f..ad6d06cc 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -8755,6 +8755,34 @@ def workout_workflow_config2_view(request,userid=0): }) +def getfavorites(r,row): + workouttype = 'ote' + if row.workouttype in mytypes.otwtypes: + workouttype = 'otw' + + matchworkouttypes = [workouttype,'all'] + + workoutsource = row.workoutsource + if 'speedcoach2' in row.workoutsource: + workoutsource = 'speedcoach2' + + try: + favorites = FavoriteChart.objects.filter(user=r, + workouttype__in=matchworkouttypes).order_by("id") + favorites2 = FavoriteChart.objects.filter(user=r, + workouttype__in=[workoutsource]).order_by("id") + + favorites = favorites | favorites2 + + + maxfav = len(favorites)-1 + except: + favorites = None + maxfav = 0 + + return favorites,maxfav + + # Workflow View @login_required() def workout_workflow_view(request,id): @@ -8774,17 +8802,8 @@ def workout_workflow_view(request,id): aantalcomments = len(comments) - workouttype = 'ote' - if row.workouttype in mytypes.otwtypes: - workouttype = 'otw' - - try: - favorites = FavoriteChart.objects.filter(user=r, - workouttype__in=[workouttype,'both']).order_by("id") - maxfav = len(favorites)-1 - except: - favorites = None - maxfav = 0 + favorites,maxfav = getfavorites(r,row) + charts = get_call() @@ -8889,13 +8908,7 @@ def workout_flexchart3_view(request,*args,**kwargs): if row.workouttype in mytypes.otwtypes: workouttype = 'otw' - try: - favorites = FavoriteChart.objects.filter(user=r, - workouttype__in=[workouttype,'both']).order_by("id") - maxfav = len(favorites)-1 - except: - favorites = None - maxfav = 0 + favorites,maxfav = getfavorites(r,row) # check if favoritenr is not out of range if favorites: diff --git a/templates/newbase.html b/templates/newbase.html index c9390afa..adc34d96 100644 --- a/templates/newbase.html +++ b/templates/newbase.html @@ -149,7 +149,7 @@ {% if user.is_authenticated %}
  • - + {% if user.rower.rowerplan == 'pro' %} {% elif user.rower.rowerplan == 'coach' %}