Private
Public Access
1
0

two small bug fixes

This commit is contained in:
Sander Roosendaal
2020-11-21 14:38:38 +01:00
parent 90fde639fd
commit cd55e5ff08
2 changed files with 30 additions and 4 deletions

View File

@@ -864,7 +864,18 @@ def rower_process_underarmourcallback(request):
# Process TrainingPeaks callback
@login_required()
def rower_process_tpcallback(request):
code = request.GET['code']
try:
code = request.GET['code']
except MultiValueDictKeyError:
messages.error(request,"There was an error with the callback")
try:
errormessage = request.GET['error']
messages.error(request,errormessage)
except MultiValueDictKeyError:
pass
url = reverse('rower_exportsettings_view')
return HttpResponseRedirect(url)
res = tpstuff.get_token(code)
access_token = res[0]

View File

@@ -6149,12 +6149,27 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
except (OverflowError, ZeroDivisionError):
avpace = datetime.timedelta(seconds=130)
try:
normspm = int(normspm)
except ValueError:
normspm = 18
try:
normw = int(normw)
except ValueError:
normw = 100
try:
normp = int(normp)
except ValueError:
normp = 100
data = {
'power': int(normp),
'power': normp,
'pace': avpace,
'selector': 'power',
'work': int(normw),
'spm': int(normspm),
'work': normw,
'spm': normspm,
'activeminutesmin': 0,
'activeminutesmax': activeminutesmax,
}