fixes
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user