bug fixes
This commit is contained in:
@@ -4193,6 +4193,13 @@ class WorkoutForm(ModelForm):
|
|||||||
else:
|
else:
|
||||||
del self.fields['plannedsession']
|
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
|
# Used for the rowing physics calculations
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ graphql_url = "https://rp3rowing-app.com/graphql"
|
|||||||
# Checks if user has UnderArmour token, renews them if they are expired
|
# Checks if user has UnderArmour token, renews them if they are expired
|
||||||
def rp3_open(user):
|
def rp3_open(user):
|
||||||
tokenexpirydate = user.rower.rp3tokenexpirydate
|
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.rp3tokenexpirydate = timezone.now()-timedelta(days=1)
|
||||||
user.rower.save()
|
user.rower.save()
|
||||||
raise NoTokenError
|
raise NoTokenError
|
||||||
|
|||||||
Reference in New Issue
Block a user