Private
Public Access
1
0

Merge branch 'feature/sources' into develop

This commit is contained in:
Sander Roosendaal
2018-10-26 09:43:43 +02:00
8 changed files with 52 additions and 30 deletions

View File

@@ -846,7 +846,8 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
pass
return new_workout_from_df(r, newdf,
title=title,boattype=boattype,
workouttype=workouttype)
workouttype=workouttype,
workoutsource=workoutsource)
try:
checks = row.check_consistency()
allchecks = 1
@@ -1403,7 +1404,7 @@ def new_workout_from_df(r, df,
oarlength = parent.oarlength
inboard = parent.inboard
workoutsource = parent.workoutsource
workouttype = parent.workouttype
boattype = parent.boattype
notes = parent.notes
@@ -1451,6 +1452,7 @@ def new_workout_from_df(r, df,
workouttype=workouttype,
boattype=boattype,
title=title,
workoutsource=workoutsource,
notes=notes,
oarlength=oarlength,
inboard=inboard,

View File

@@ -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)

View File

@@ -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)'),

View File

@@ -100,7 +100,7 @@
<td> {{ actualvalue|lookup:ps.id }}</td>
<td> {{ ps.sessionunit }} </td>
{% if completeness|lookup:ps.id == 'partial' %}
<td style="color:darkgray"><i> {{ completiondate|lookup:ps.id|date:"Y-m-d" }}</i></td>
<td style="color:darkgray"><em> {{ completiondate|lookup:ps.id|date:"Y-m-d" }}</em></td>
{% else %}
<td> {{ completiondate|lookup:ps.id|date:"Y-m-d" }}</td>
{% endif %}

View File

@@ -74,7 +74,9 @@ $('#id_workouttype').change();
</tr><tr>
<th>Duration:</th><td>{{ workout.duration |durationprint:"%H:%M:%S.%f" }}</td>
</tr><tr>
<th>Public link to this workout</th>
<th>Source:</th><td>{{ workout.workoutsource }}</td>
</tr><tr>
<th>Public link to this workout:</th>
<td>
<a href="/rowers/workout/{{ workout.id }}">https://rowsandall.com/rowers/workout/{{ workout.id }}</a>
</td>

View File

@@ -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

View File

@@ -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:

View File

@@ -149,7 +149,7 @@
</li>
{% if user.is_authenticated %}
<li>
<a href="/rowers/me/edit" title="Profile">
<a href="/rowers/me/preferences" title="Profile">
{% if user.rower.rowerplan == 'pro' %}
<i class="fas fa-user-ninja "></i>
{% elif user.rower.rowerplan == 'coach' %}