Private
Public Access
1
0

Merge branch 'release/v15.6.1'

This commit is contained in:
Sander Roosendaal
2021-03-05 14:43:47 +01:00
4 changed files with 20 additions and 12 deletions

View File

@@ -2317,6 +2317,7 @@ class PlannedSession(models.Model):
is_template = models.BooleanField(default=False)
is_public = models.BooleanField(default=False)
can_be_shared = models.BooleanField(default=True)
fitfile = models.FileField(upload_to=get_file_path,blank=True,null=True)
#steps_json = models.TextField(max_length=10000,default=None,blank=True,null=True)

View File

@@ -37,9 +37,6 @@
</li>
<li class="grid_2">
<h1>Library</h1>
<p>
Click on session name to clone to current period
</p>
<table class="listtable shortpadded" width="80%">
<thead>
<tr>
@@ -55,11 +52,9 @@
<tr>
<td>
{% if ps.name != '' %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/clone/user/{{ rower.user.id }}/?when={{ timeperiod }}">{{ ps.name }}</a>
{{ ps.name }}
{% else %}
<a class="small"
href="/rowers/sessions/{{ ps.id }}/clone/user/{{ rower.user.id }}/?when={{ timeperiod }}">Unnamed Session</a>
Unnamed Session
{% endif %}
</td>
<td> {{ ps.sessionvalue }} </td>

View File

@@ -919,9 +919,18 @@ def step_to_string(step):
ph = pacestringhigh,
)
elif targettype == 'Cadence':
value = step['targetValue']
valuelow = step['targetValueLow']
valuehigh = step['targetValueHigh']
try:
value = step['targetValue']
except KeyError:
value = 0
try:
valuelow = step['targetValueLow']
except KeyError:
valuelow = 0
try:
valuehigh = step['targetValueHigh']
except KeyError:
valuehigh = 0
if value != 0:
target = 'Target: Cadence at {v} SPM'.format(v=value)

View File

@@ -419,8 +419,11 @@ def plannedsession_multiclone_view(
def template_share_view(request,id=0,userid=0):
r = getrequestplanrower(request,userid=userid)
ps = get_object_or_404(PlannedSession,pk=id)
ps.is_public = True
ps.save()
if ps.can_be_shared:
ps.is_public = True
ps.save()
else:
messages.error(request,'This planned session comes from a third party and cannot be shared')
return HttpResponseRedirect(reverse(template_library_view))