Private
Public Access
1
0

bug fixes

This commit is contained in:
Sander Roosendaal
2023-01-21 09:31:26 +01:00
parent 552b6d5298
commit 7ccebc7a98
2 changed files with 10 additions and 1 deletions

View File

@@ -4193,6 +4193,13 @@ class WorkoutForm(ModelForm):
else:
del self.fields['plannedsession']
def clean(self):
if any(self.errors):
return
cd = self.cleaned_data
if cd['duration'] is None or cd['duration'] == '':
raise forms.ValidationError('Duration cannot be empty')
# Used for the rowing physics calculations

View File

@@ -51,7 +51,9 @@ graphql_url = "https://rp3rowing-app.com/graphql"
# Checks if user has UnderArmour token, renews them if they are expired
def rp3_open(user):
tokenexpirydate = user.rower.rp3tokenexpirydate
if timezone.now()-timedelta(days=120)>tokenexpirydate:
if tokenexpirydate is None:
raise NoTokenError
if tokenexpirydate is not None and timezone.now()-timedelta(days=120)>tokenexpirydate:
user.rower.rp3tokenexpirydate = timezone.now()-timedelta(days=1)
user.rower.save()
raise NoTokenError