Private
Public Access
1
0
This commit is contained in:
2023-09-10 10:06:07 +02:00
parent 62ba77b6e8
commit c8eb297a9d
3 changed files with 18 additions and 2 deletions

View File

@@ -126,7 +126,11 @@ def rscore_approx(row):
else:
dd = 3600*row['duration'].hour+60*row['duration'].minute+row['duration'].second
dd = dd/3600
return int(rpetotss[row['rpe']]*dd)
try:
return int(rpetotss[row['rpe']]*dd)
except KeyError:
minutes = row['duration'].hour*60+row['duration'].minute
return minutes
if row['rscore'] < 0:
w = Workout.objects.get(id=row['id'])
trimp, hrtss = workout_trimp(w)

View File

@@ -1472,6 +1472,7 @@ def handle_calctrimp(id,
try:
grpc.channel_ready_future(channel).result(timeout=10)
except grpc.FutureTimeoutError: # pragma: no cover
dologging('metrics.log','grpc channel time out in handle_calctrimp')
return 0
stub = metrics_pb2_grpc.MetricsStub(channel)
@@ -1485,7 +1486,8 @@ def handle_calctrimp(id,
)
try:
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
tss = response.tss
@@ -1494,6 +1496,15 @@ def handle_calctrimp(id,
normv = response.normv
normw = response.normw
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
tss = 0
@@ -1534,6 +1545,7 @@ def handle_calctrimp(id,
try:
workout = Workout.objects.get(id=id)
except Workout.DoesNotExist:
dologging('metrics.log','Could not find workout {id}'.format(id=id))
return 0
workout.rscore = int(tss)

Binary file not shown.