Private
Public Access
1
0

Merge branch 'release/v20.1.28'

This commit is contained in:
2023-09-10 10:06:50 +02:00
4 changed files with 24 additions and 2 deletions
+4
View File
@@ -126,7 +126,11 @@ def rscore_approx(row):
else: else:
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
dd = dd/3600 dd = dd/3600
try:
return int(rpetotss[row['rpe']]*dd) return int(rpetotss[row['rpe']]*dd)
except KeyError:
minutes = row['duration'].hour*60+row['duration'].minute
return minutes
if row['rscore'] < 0: if row['rscore'] < 0:
w = Workout.objects.get(id=row['id']) w = Workout.objects.get(id=row['id'])
trimp, hrtss = workout_trimp(w) trimp, hrtss = workout_trimp(w)
+13 -1
View File
@@ -1472,6 +1472,7 @@ def handle_calctrimp(id,
try: try:
grpc.channel_ready_future(channel).result(timeout=10) grpc.channel_ready_future(channel).result(timeout=10)
except grpc.FutureTimeoutError: # pragma: no cover except grpc.FutureTimeoutError: # pragma: no cover
dologging('metrics.log','grpc channel time out in handle_calctrimp')
return 0 return 0
stub = metrics_pb2_grpc.MetricsStub(channel) stub = metrics_pb2_grpc.MetricsStub(channel)
@@ -1485,7 +1486,8 @@ def handle_calctrimp(id,
) )
try: try:
response = stub.CalcMetrics(req, timeout=60) response = stub.CalcMetrics(req, timeout=60)
except: # pragma: no cover except Exception as e: # pragma: no cover
dologging('metrics.log',traceback.format_exc())
return 0 return 0
tss = response.tss tss = response.tss
@@ -1494,6 +1496,15 @@ def handle_calctrimp(id,
normv = response.normv normv = response.normv
normw = response.normw normw = response.normw
hrtss = response.hrtss hrtss = response.hrtss
dologging('metrics.log','Got tss {tss}, normp {normp} trimp {trimp} normv {normv} normw {normw} hrtss {hrtss}'.format(
tss = tss,
normp = normp,
trimp = trimp,
normv = normv,
normw = normw,
hrtss = hrtss
))
if np.isnan(tss): # pragma: no cover if np.isnan(tss): # pragma: no cover
tss = 0 tss = 0
@@ -1534,6 +1545,7 @@ def handle_calctrimp(id,
try: try:
workout = Workout.objects.get(id=id) workout = Workout.objects.get(id=id)
except Workout.DoesNotExist: except Workout.DoesNotExist:
dologging('metrics.log','Could not find workout {id}'.format(id=id))
return 0 return 0
workout.rscore = int(tss) workout.rscore = int(tss)
Binary file not shown.
+6
View File
@@ -323,6 +323,12 @@ def rower_process_nkcallback(request): # pragma: no cover
message = "The resource owner or authorization server denied the request" message = "The resource owner or authorization server denied the request"
messages.error(request, message) messages.error(request, message)
url = reverse('rower_exportsettings_view')
return HttpResponseRedirect(url)
except NoTokenError:
message = "Could not fetch token. Please reconnect with NK Logbook"
messages.error(request, message)
url = reverse('rower_exportsettings_view') url = reverse('rower_exportsettings_view')
return HttpResponseRedirect(url) return HttpResponseRedirect(url)