Private
Public Access
1
0

Merge branch 'release/v15.6.4'

This commit is contained in:
Sander Roosendaal
2021-03-06 16:15:28 +01:00
5 changed files with 47 additions and 11 deletions

View File

@@ -8,6 +8,16 @@
<h1>Planned Sessions for {{ rower.user.first_name }} {{ rower.user.last_name }}</h1>
<p>
<a href="/rowers/sessions/create/?when={{ timeperiod }}"> <i class="far fa-calendar-plus fa-fw"></i>&nbsp;Add Session
</a>
{% if request.user|user_teams %}
<a href="/rowers/sessions/teamcreate/?when={{ timeperiod }}">
<i class="fas fa-whistle fa-fw"></i>&nbsp;Add Group Session
</a>
{% endif %}
</p>
<ul class="main-content">
<li class="grid_2">
<p>

View File

@@ -740,8 +740,12 @@ class PermissionsViewTests(TestCase):
form = PlannedSessionForm(post_data)
self.assertTrue(form.is_valid())
expected_url = reverse('plannedsessions_view',kwargs={'userid':0})
response = self.c.post(url,post_data)
self.assertEqual(response.status_code,200)
self.assertRedirects(response,
expected_url=expected_url,
status_code=302,target_status_code=200)
@@ -1118,8 +1122,12 @@ class PermissionsViewTests(TestCase):
form = PlannedSessionForm(post_data)
self.assertTrue(form.is_valid())
response = self.c.post(url,post_data)
self.assertEqual(response.status_code,200)
expected_url = reverse('plannedsessions_view',kwargs={'userid':0})
response = self.c.post(url,post_data,follow=True)
self.assertRedirects(response,
expected_url=expected_url,
status_code=302,target_status_code=200)

View File

@@ -167,8 +167,13 @@ class TrainingPlanTest(TestCase):
form = PlannedSessionForm(post_data)
self.assertTrue(form.is_valid())
expected_url = reverse('plannedsessions_view',kwargs={'userid':0})
response = self.c.post(url,post_data)
self.assertEqual(response.status_code,200)
self.assertRedirects(response,
expected_url=expected_url,
status_code=302,target_status_code=200)

View File

@@ -901,7 +901,11 @@ def step_to_string(step):
if value < 10 and value>0:
target = 'Target: Power in zone {v}'.format(v=value)
else:
elif value > 10 and value < 1000:
target = 'Target: Power at {v} % of FTP'.format(v=value)
elif value > 1000:
target = 'Target: Power at {v} Watt'.format(v=value-1000)
elif valuelow > 0 and valuehigh > 0:
if valuelow < 1000:
target = 'Target: Power between {l} and {h} % of FTP'.format(
l = valuelow,

View File

@@ -531,6 +531,11 @@ def plannedsession_create_view(request,
request.session['fenddate'] = str(arrow.get(ps.enddate))
request.session['fprefdate'] = str(arrow.get(ps.preferreddate))
url = reverse(plannedsessions_view,kwargs={
'userid':userid,
})
return HttpResponseRedirect(url)
else:
if 'fstartdate' in request.session:
try:
@@ -921,15 +926,19 @@ def plannedsession_teamcreate_view(request,
for r in rs:
add_rower_session(r,ps)
url = reverse(plannedsessions_view,kwargs={
'userid':userid,
})
return HttpResponseRedirect(url)
url = reverse(plannedsession_teamcreate_view)
startdatestring = startdate.strftime('%Y-%m-%d')
enddatestring = enddate.strftime('%Y-%m-%d')
url += '?when='+startdatestring+'/'+enddatestring
#url = reverse(plannedsession_teamcreate_view)
#startdatestring = startdate.strftime('%Y-%m-%d')
#enddatestring = enddate.strftime('%Y-%m-%d')
#url += '?when='+startdatestring+'/'+enddatestring
next = request.GET.get('next', url)
#next = request.GET.get('next', url)
return HttpResponseRedirect(next)
#return HttpResponseRedirect(next)
else:
timeperiod = startdate.strftime('%Y-%m-%d')+'/'+enddate.strftime('%Y-%m-%d')
breadcrumbs = [