Private
Public Access
1
0

Merge branch 'release/v18.6.23'

This commit is contained in:
Sander Roosendaal
2022-09-19 20:29:25 +02:00
3 changed files with 29 additions and 20 deletions

View File

@@ -3529,26 +3529,32 @@ class Workout(models.Model):
workouttype = self.workouttype
if workouttype != 'water':
stri = u'{d} {n} {dist}m {duration} {workouttype} {ownerfirst} {ownerlast}'.format(
d=date.strftime('%Y-%m-%d'),
n=name,
dist=distance,
duration=duration.strftime("%H:%M:%S"),
workouttype=workouttype,
ownerfirst=ownerfirst,
ownerlast=ownerlast,
)
try:
stri = u'{d} {n} {dist}m {duration} {workouttype} {ownerfirst} {ownerlast}'.format(
d=date.strftime('%Y-%m-%d'),
n=name,
dist=distance,
duration=duration.strftime("%H:%M:%S"),
workouttype=workouttype,
ownerfirst=ownerfirst,
ownerlast=ownerlast,
)
except ValueError:
stri = 'workout'
else:
stri = u'{d} {n} {dist}m {duration:%H:%M:%S} {workouttype} {boattype} {ownerfirst} {ownerlast}'.format(
d=date.strftime('%Y-%m-%d'),
n=name,
dist=distance,
duration=duration,
workouttype=workouttype,
boattype=boattype,
ownerfirst=ownerfirst,
ownerlast=ownerlast,
)
try:
stri = u'{d} {n} {dist}m {duration} {workouttype} {boattype} {ownerfirst} {ownerlast}'.format(
d=date.strftime('%Y-%m-%d'),
n=name,
dist=distance,
duration=duration.strftime("%H:%M:%S"),
workouttype=workouttype,
boattype=boattype,
ownerfirst=ownerfirst,
ownerlast=ownerlast,
)
except ValueError:
stri = 'workout'
return stri

View File

@@ -58,6 +58,7 @@ def get_token(code): # pragma: no cover
response = requests.post(url, auth=HTTPBasicAuth(oauth_data['client_id'], oauth_data['client_secret']),
data=post_data)
if response.status_code != 200:
return [0, response.text, 0, 0]

View File

@@ -221,6 +221,7 @@ class AsyncTaskTests(TestCase):
userfirstname = self.u.first_name
userlastname = self.u.last_name,
rowerfirstname = self.u.first_name,
rowerlastname = self.u.last_name,
alertname = 'Test Alert'
stats = {
'percentage': 45,
@@ -234,7 +235,8 @@ class AsyncTaskTests(TestCase):
}
res = tasks.handle_send_email_alert(useremail,userfirstname,userlastname,
rowerfirstname,alertname,stats)
rowerfirstname,
rowerlastname,alertname,stats)
self.assertEqual(res,1)