Private
Public Access
1
0

Merge branch 'develop' into feature/django4.2

This commit is contained in:
2024-05-25 15:15:02 +02:00
8 changed files with 34 additions and 9 deletions

View File

@@ -1971,7 +1971,7 @@ def interactive_flex_chart2(id, r, promember=0,
'plottype': plottype,
}
script, div = get_chart("/flex", chart_data, debug=False)
script, div = get_chart("/flex2", chart_data, debug=False)
return script, div, workstrokesonly

View File

@@ -3697,13 +3697,22 @@ class Workout(models.Model):
def __str__(self):
try:
dates = self.date.strftime('%Y-%m-%d')
except AttributeError:
dates = ''
try:
durations = self.duration.strftime("%H:%M:%S"),
except AttributeError:
durations = ''
elements = dict(
date = self.date.strftime('%Y-%m-%d'),
date = dates,
name = self.name,
distance = str(self.distance)+'m',
ownerfirst = self.user.user.first_name,
ownerlast = self.user.user.last_name,
duration = self.duration.strftime("%H:%M:%S"),
duration = durations,
boattype = self.boattype,
workouttype = self.workouttype,
seatnumber = 'seat '+str(self.seatnumber),

View File

@@ -96,6 +96,8 @@ def add_workout_from_data(userid, nkid, data, strokedata, source='nk', splitdata
oarInboardLength = 88
seatNumber = 1
oarlockfirmware = ''
boatName = ''
portStarboard = 'port'
workouttype = "water"
boattype = "1x"

View File

@@ -2069,7 +2069,10 @@ def handle_sendemail_breakthrough(workoutid, useremail,
**kwargs):
btvalues = pd.read_json(btvalues)
btvalues.sort_values('delta', axis=0, inplace=True)
try:
btvalues.sort_values('delta', axis=0, inplace=True)
except KeyError:
return 0
lastname = ''
@@ -3188,6 +3191,10 @@ def handle_update_wps(rid, types, ids, mode, debug=False, **kwargs):
wps_median = 0
except ColumnNotFoundError:
wps_median = 0
except TypeError:
wps_median = 0
except ComputeError:
wps_median = 0
return wps_median

View File

@@ -6,6 +6,7 @@ from __future__ import unicode_literals
from .statements import *
from django.http import Http404
from django_recaptcha.client import RecaptchaResponse
from rowers.views import get_workout
@@ -69,7 +70,10 @@ class SimpleViewTest(TestCase):
response = self.c.get(url)
self.assertIn(response.status_code, [403, 404])
def test_sendmail(self):
@patch("django_recaptcha.fields.client.submit")
def test_sendmail(self, mocked_submit):
mocked_submit.return_value = RecaptchaResponse(is_valid=True, extra_data={"score":0.95})
login = self.c.login(username=self.u.username, password=self.password)
self.assertTrue(login)
@@ -80,18 +84,20 @@ class SimpleViewTest(TestCase):
'lastname': 'Doe',
'email': 'roosendaalsander@gmail.com',
'subject': 'testing',
'botcheck': True,
'captcha': 'sdsdsdsdsdsdss',
'g-recaptcha-response': 'PASSED',
'message': faker.text()}
form = EmailForm(form_data)
self.assertTrue(form.is_valid())
response = self.c.post(url, form_data, follow=True)
self.assertEqual(response.status_code, 200)
self.assertRedirects(response,
expected_url='/rowers/email/',
expected_url='/rowers/email/thankyou/',
status_code=302, target_status_code=200)
def test_getworkout(self):

Binary file not shown.

View File

@@ -134,7 +134,7 @@
175,220,rower_favoritecharts_view,See favorite charts,TRUE,302,pro,200,302,pro,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE,
176,222,workout_workflow_config2_view,configure workflow,TRUE,302,basic,200,302,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,FALSE,FALSE,
177,224,workflow_default_view,resets workflow to default,TRUE,302,basic,302,302,FALSE,403,403,FALSE,302,403,FALSE,FALSE,FALSE,TRUE,TRUE,
178,225,sendmail,feedback form,TRUE,302,basic,302,302,FALSE,200,302,FALSE,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
178,225,sendmail,feedback form,TRUE,200,basic,200,302,FALSE,200,302,FALSE,200,302,FALSE,FALSE,FALSE,TRUE,TRUE,
180,232,laboratory_view,lab,TRUE,302,basic,200,302,basic,403,403,coach,200,403,FALSE,TRUE,FALSE,TRUE,TRUE,
181,233,errormessage_view,not used,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
182,237,payment_confirm_view,confirm payment,TRUE,200,basic,200,302,basic,200,302,coach,200,302,FALSE,FALSE,FALSE,FALSE,FALSE,
1 id view function anonymous anonymous_response own own_response own_nonperm member member_response member_nonperm coachee coachee_response coachee_nonperm is_staff userid workoutid dotest realtest kwargs
134 175 220 rower_favoritecharts_view See favorite charts TRUE 302 pro 200 302 pro 403 403 coach 200 403 FALSE TRUE FALSE TRUE TRUE
135 176 222 workout_workflow_config2_view configure workflow TRUE 302 basic 200 302 basic 403 403 coach 200 403 FALSE TRUE FALSE FALSE FALSE
136 177 224 workflow_default_view resets workflow to default TRUE 302 basic 302 302 FALSE 403 403 FALSE 302 403 FALSE FALSE FALSE TRUE TRUE
137 178 225 sendmail feedback form TRUE 302 200 basic 302 200 302 FALSE 200 302 FALSE 200 302 FALSE FALSE FALSE TRUE TRUE
138 180 232 laboratory_view lab TRUE 302 basic 200 302 basic 403 403 coach 200 403 FALSE TRUE FALSE TRUE TRUE
139 181 233 errormessage_view not used TRUE 200 basic 200 302 basic 200 302 coach 200 302 FALSE FALSE FALSE FALSE FALSE
140 182 237 payment_confirm_view confirm payment TRUE 200 basic 200 302 basic 200 302 coach 200 302 FALSE FALSE FALSE FALSE FALSE

View File

@@ -2229,7 +2229,8 @@ def history_view_data(request, userid=0):
df = df.with_columns(pl.col('time').diff().clip(lower_bound=0).alias("deltat"))
except KeyError: # pragma: no cover
pass
except ColumnNotFoundError:
pass
totalmeters, totalhours, totalminutes, totalseconds = get_totals(
g_workouts)