getting it to work
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 235 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 179 KiB |
@@ -1480,9 +1480,15 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
r.running_wps = 400.
|
r.running_wps = 400.
|
||||||
r.save()
|
r.save()
|
||||||
|
|
||||||
|
if w.workouttype in otwtypes:
|
||||||
|
wps_avg = r.median_wps
|
||||||
|
elif w.workouttype in otetypes:
|
||||||
|
wps_avg = r.median_wps_erg
|
||||||
|
else:
|
||||||
|
wps_avg = 0
|
||||||
|
|
||||||
_ = myqueue(queuehigh, handle_calctrimp, w.id, f2,
|
_ = myqueue(queuehigh, handle_calctrimp, w.id, f2,
|
||||||
r.ftp, r.sex, r.hrftp, r.max, r.rest)
|
r.ftp, r.sex, r.hrftp, r.max, r.rest, wps_avg)
|
||||||
|
|
||||||
return (w.id, message)
|
return (w.id, message)
|
||||||
|
|
||||||
@@ -1771,8 +1777,15 @@ def new_workout_from_df(r, df,
|
|||||||
rpe=rpe,
|
rpe=rpe,
|
||||||
consistencychecks=False)
|
consistencychecks=False)
|
||||||
|
|
||||||
|
if workouttype in otwtypes:
|
||||||
|
wps_avg = r.median_wps
|
||||||
|
elif workouttype in otetypes:
|
||||||
|
wps_avg = r.median_wps_erg
|
||||||
|
else:
|
||||||
|
wps_avg = 0
|
||||||
|
|
||||||
_ = myqueue(queuehigh, handle_calctrimp, id, csvfilename,
|
_ = myqueue(queuehigh, handle_calctrimp, id, csvfilename,
|
||||||
r.ftp, r.sex, r.hrftp, r.max, r.rest)
|
r.ftp, r.sex, r.hrftp, r.max, r.rest, wps_avg)
|
||||||
|
|
||||||
return (id, message)
|
return (id, message)
|
||||||
|
|
||||||
@@ -1814,7 +1827,14 @@ def workout_trimp(w, reset=False):
|
|||||||
return 0, 100.*(w.averagehr/r.hrftp)*(w.duration.hour*60 + w.duration.minute)/60.
|
return 0, 100.*(w.averagehr/r.hrftp)*(w.duration.hour*60 + w.duration.minute)/60.
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
|
||||||
|
if w.workouttype in otwtypes:
|
||||||
|
wps_avg = r.median_wps
|
||||||
|
elif w.workouttype in otetypes:
|
||||||
|
wps_avg = r.median_wps_erg
|
||||||
|
else:
|
||||||
|
wps_avg = 0
|
||||||
|
|
||||||
ftp = float(r.ftp)
|
ftp = float(r.ftp)
|
||||||
_ = myqueue(
|
_ = myqueue(
|
||||||
queuehigh,
|
queuehigh,
|
||||||
@@ -1825,7 +1845,9 @@ def workout_trimp(w, reset=False):
|
|||||||
r.sex,
|
r.sex,
|
||||||
r.hrftp,
|
r.hrftp,
|
||||||
r.max,
|
r.max,
|
||||||
r.rest)
|
r.rest,
|
||||||
|
wps_avg,
|
||||||
|
)
|
||||||
return w.trimp, w.hrtss
|
return w.trimp, w.hrtss
|
||||||
elif w.trimp > -1 and not reset:
|
elif w.trimp > -1 and not reset:
|
||||||
return w.trimp, w.hrtss
|
return w.trimp, w.hrtss
|
||||||
@@ -1857,6 +1879,13 @@ def workout_trimp(w, reset=False):
|
|||||||
w.maxhr = maxhr
|
w.maxhr = maxhr
|
||||||
w.save()
|
w.save()
|
||||||
|
|
||||||
|
if w.workouttype in otwtypes:
|
||||||
|
wps_avg = r.median_wps
|
||||||
|
elif w.workouttype in otetypes:
|
||||||
|
wps_avg = r.median_wps_erg
|
||||||
|
else:
|
||||||
|
wps_avg = 0
|
||||||
|
|
||||||
_ = myqueue(
|
_ = myqueue(
|
||||||
queuehigh,
|
queuehigh,
|
||||||
handle_calctrimp,
|
handle_calctrimp,
|
||||||
@@ -1866,7 +1895,8 @@ def workout_trimp(w, reset=False):
|
|||||||
r.sex,
|
r.sex,
|
||||||
r.hrftp,
|
r.hrftp,
|
||||||
r.max,
|
r.max,
|
||||||
r.rest)
|
r.rest,
|
||||||
|
wps_avg,)
|
||||||
|
|
||||||
trimp = 0
|
trimp = 0
|
||||||
averagehr = 0
|
averagehr = 0
|
||||||
@@ -1877,6 +1907,45 @@ def workout_trimp(w, reset=False):
|
|||||||
|
|
||||||
return trimp, averagehr
|
return trimp, averagehr
|
||||||
|
|
||||||
|
def workout_spmtss(w, reset=False):
|
||||||
|
if w.spmtss > -1 and not reset:
|
||||||
|
return w.spmtss
|
||||||
|
|
||||||
|
if get_existing_job(w):
|
||||||
|
return 0, 0
|
||||||
|
|
||||||
|
r = w.user
|
||||||
|
ftp = float(r.ftp)
|
||||||
|
if w.workouttype in otwtypes:
|
||||||
|
ftp = ftp*(100.-r.otwslack)/100.
|
||||||
|
|
||||||
|
if r.hrftp == 0:
|
||||||
|
hrftp = (r.an+r.tr)/2.
|
||||||
|
r.hrftp = int(hrftp)
|
||||||
|
r.save()
|
||||||
|
|
||||||
|
if w.workouttype in otwtypes:
|
||||||
|
wps_avg = r.median_wps
|
||||||
|
elif w.workouttype in otetypes:
|
||||||
|
wps_avg = r.median_wps_erg
|
||||||
|
else:
|
||||||
|
wps_avg = 0
|
||||||
|
|
||||||
|
_ = myqueue(
|
||||||
|
queuehigh,
|
||||||
|
handle_calctrimp,
|
||||||
|
w.id,
|
||||||
|
w.csvfilename,
|
||||||
|
ftp,
|
||||||
|
r.sex,
|
||||||
|
r.hrftp,
|
||||||
|
r.max,
|
||||||
|
r.rest,
|
||||||
|
wps_avg,)
|
||||||
|
|
||||||
|
return w.spmtss
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def workout_rscore(w, reset=False):
|
def workout_rscore(w, reset=False):
|
||||||
dologging('metrics.log','Workout_rscore for {w} {id}, {reset}'.format(
|
dologging('metrics.log','Workout_rscore for {w} {id}, {reset}'.format(
|
||||||
@@ -1906,6 +1975,13 @@ def workout_rscore(w, reset=False):
|
|||||||
r.save()
|
r.save()
|
||||||
|
|
||||||
dologging('metrics.log','Queueing an asynchronous task')
|
dologging('metrics.log','Queueing an asynchronous task')
|
||||||
|
|
||||||
|
if w.workouttype in otwtypes:
|
||||||
|
wps_avg = r.median_wps
|
||||||
|
elif w.workouttype in otetypes:
|
||||||
|
wps_avg = r.median_wps_erg
|
||||||
|
else:
|
||||||
|
wps_avg = 0
|
||||||
|
|
||||||
_ = myqueue(
|
_ = myqueue(
|
||||||
queuehigh,
|
queuehigh,
|
||||||
@@ -1916,7 +1992,8 @@ def workout_rscore(w, reset=False):
|
|||||||
r.sex,
|
r.sex,
|
||||||
r.hrftp,
|
r.hrftp,
|
||||||
r.max,
|
r.max,
|
||||||
r.rest)
|
r.rest,
|
||||||
|
wps_avg,)
|
||||||
|
|
||||||
return w.rscore, w.normp
|
return w.rscore, w.normp
|
||||||
|
|
||||||
@@ -1938,6 +2015,13 @@ def workout_normv(w, pp=4.0):
|
|||||||
r.hrftp = int(hrftp)
|
r.hrftp = int(hrftp)
|
||||||
r.save()
|
r.save()
|
||||||
|
|
||||||
|
if w.workouttype in otwtypes:
|
||||||
|
wps_avg = r.median_wps
|
||||||
|
elif w.workouttype in otetypes:
|
||||||
|
wps_avg = r.median_wps_erg
|
||||||
|
else:
|
||||||
|
wps_avg = 0
|
||||||
|
|
||||||
_ = myqueue(
|
_ = myqueue(
|
||||||
queuehigh,
|
queuehigh,
|
||||||
handle_calctrimp,
|
handle_calctrimp,
|
||||||
@@ -1947,6 +2031,6 @@ def workout_normv(w, pp=4.0):
|
|||||||
r.sex,
|
r.sex,
|
||||||
r.hrftp,
|
r.hrftp,
|
||||||
r.max,
|
r.max,
|
||||||
r.rest)
|
r.rest, wps_avg)
|
||||||
|
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
|||||||
@@ -3746,6 +3746,7 @@ class Workout(models.Model):
|
|||||||
trimp = models.IntegerField(default=-1, blank=True)
|
trimp = models.IntegerField(default=-1, blank=True)
|
||||||
rscore = models.IntegerField(default=-1, blank=True)
|
rscore = models.IntegerField(default=-1, blank=True)
|
||||||
hrtss = models.IntegerField(default=-1, blank=True)
|
hrtss = models.IntegerField(default=-1, blank=True)
|
||||||
|
spmtss = models.IntegerField(default=-1, blank=True)
|
||||||
normp = models.IntegerField(default=-1, blank=True)
|
normp = models.IntegerField(default=-1, blank=True)
|
||||||
normv = models.FloatField(default=-1, blank=True)
|
normv = models.FloatField(default=-1, blank=True)
|
||||||
normw = models.FloatField(default=-1, blank=True)
|
normw = models.FloatField(default=-1, blank=True)
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||||
|
# NO CHECKED-IN PROTOBUF GENCODE
|
||||||
# source: rowing-workout-metrics.proto
|
# source: rowing-workout-metrics.proto
|
||||||
# Protobuf Python Version: 4.25.1
|
# Protobuf Python Version: 5.29.0
|
||||||
"""Generated protocol buffer code."""
|
"""Generated protocol buffer code."""
|
||||||
from google.protobuf import descriptor as _descriptor
|
from google.protobuf import descriptor as _descriptor
|
||||||
from google.protobuf import descriptor_pool as _descriptor_pool
|
from google.protobuf import descriptor_pool as _descriptor_pool
|
||||||
|
from google.protobuf import runtime_version as _runtime_version
|
||||||
from google.protobuf import symbol_database as _symbol_database
|
from google.protobuf import symbol_database as _symbol_database
|
||||||
from google.protobuf.internal import builder as _builder
|
from google.protobuf.internal import builder as _builder
|
||||||
|
_runtime_version.ValidateProtobufRuntimeVersion(
|
||||||
|
_runtime_version.Domain.PUBLIC,
|
||||||
|
5,
|
||||||
|
29,
|
||||||
|
0,
|
||||||
|
'',
|
||||||
|
'rowing-workout-metrics.proto'
|
||||||
|
)
|
||||||
# @@protoc_insertion_point(imports)
|
# @@protoc_insertion_point(imports)
|
||||||
|
|
||||||
_sym_db = _symbol_database.Default()
|
_sym_db = _symbol_database.Default()
|
||||||
@@ -14,22 +24,22 @@ _sym_db = _symbol_database.Default()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1crowing-workout-metrics.proto\x12\x16rowing_workout_metrics\"p\n\x15WorkoutMetricsRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x0b\n\x03sex\x18\x02 \x01(\t\x12\x0b\n\x03\x66tp\x18\x03 \x01(\x01\x12\r\n\x05hrftp\x18\x04 \x01(\x01\x12\r\n\x05hrmax\x18\x05 \x01(\x01\x12\r\n\x05hrmin\x18\x06 \x01(\x01\"p\n\x16WorkoutMetricsResponse\x12\x0b\n\x03tss\x18\x01 \x01(\x01\x12\r\n\x05normp\x18\x02 \x01(\x01\x12\r\n\x05trimp\x18\x03 \x01(\x01\x12\r\n\x05hrtss\x18\x04 \x01(\x01\x12\r\n\x05normv\x18\x05 \x01(\x01\x12\r\n\x05normw\x18\x06 \x01(\x01\"=\n\tCPRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x10\n\x08\x66iletype\x18\x02 \x01(\t\x12\x0c\n\x04tarr\x18\x03 \x03(\x01\"<\n\nCPResponse\x12\r\n\x05\x64\x65lta\x18\x01 \x03(\x01\x12\r\n\x05power\x18\x02 \x03(\x01\x12\x10\n\x08\x61vgpower\x18\x03 \x01(\x01\x32\xc7\x01\n\x07Metrics\x12l\n\x0b\x43\x61lcMetrics\x12-.rowing_workout_metrics.WorkoutMetricsRequest\x1a..rowing_workout_metrics.WorkoutMetricsResponse\x12N\n\x05GetCP\x12!.rowing_workout_metrics.CPRequest\x1a\".rowing_workout_metrics.CPResponseB\x1aZ\x18./rowing-workout-metricsb\x06proto3')
|
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1crowing-workout-metrics.proto\x12\x16rowing_workout_metrics\"\x80\x01\n\x15WorkoutMetricsRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x0b\n\x03sex\x18\x02 \x01(\t\x12\x0b\n\x03\x66tp\x18\x03 \x01(\x01\x12\r\n\x05hrftp\x18\x04 \x01(\x01\x12\r\n\x05hrmax\x18\x05 \x01(\x01\x12\r\n\x05hrmin\x18\x06 \x01(\x01\x12\x0e\n\x06wpsavg\x18\x07 \x01(\x01\"\x80\x01\n\x16WorkoutMetricsResponse\x12\x0b\n\x03tss\x18\x01 \x01(\x01\x12\r\n\x05normp\x18\x02 \x01(\x01\x12\r\n\x05trimp\x18\x03 \x01(\x01\x12\r\n\x05hrtss\x18\x04 \x01(\x01\x12\r\n\x05normv\x18\x05 \x01(\x01\x12\r\n\x05normw\x18\x06 \x01(\x01\x12\x0e\n\x06spmtss\x18\x07 \x01(\x01\"=\n\tCPRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x10\n\x08\x66iletype\x18\x02 \x01(\t\x12\x0c\n\x04tarr\x18\x03 \x03(\x01\"<\n\nCPResponse\x12\r\n\x05\x64\x65lta\x18\x01 \x03(\x01\x12\r\n\x05power\x18\x02 \x03(\x01\x12\x10\n\x08\x61vgpower\x18\x03 \x01(\x01\x32\xc7\x01\n\x07Metrics\x12l\n\x0b\x43\x61lcMetrics\x12-.rowing_workout_metrics.WorkoutMetricsRequest\x1a..rowing_workout_metrics.WorkoutMetricsResponse\x12N\n\x05GetCP\x12!.rowing_workout_metrics.CPRequest\x1a\".rowing_workout_metrics.CPResponseB\x1aZ\x18./rowing-workout-metricsb\x06proto3')
|
||||||
|
|
||||||
_globals = globals()
|
_globals = globals()
|
||||||
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
||||||
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'rowing_workout_metrics_pb2', _globals)
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'rowing_workout_metrics_pb2', _globals)
|
||||||
if _descriptor._USE_C_DESCRIPTORS == False:
|
if not _descriptor._USE_C_DESCRIPTORS:
|
||||||
_globals['DESCRIPTOR']._options = None
|
_globals['DESCRIPTOR']._loaded_options = None
|
||||||
_globals['DESCRIPTOR']._serialized_options = b'Z\030./rowing-workout-metrics'
|
_globals['DESCRIPTOR']._serialized_options = b'Z\030./rowing-workout-metrics'
|
||||||
_globals['_WORKOUTMETRICSREQUEST']._serialized_start=56
|
_globals['_WORKOUTMETRICSREQUEST']._serialized_start=57
|
||||||
_globals['_WORKOUTMETRICSREQUEST']._serialized_end=168
|
_globals['_WORKOUTMETRICSREQUEST']._serialized_end=185
|
||||||
_globals['_WORKOUTMETRICSRESPONSE']._serialized_start=170
|
_globals['_WORKOUTMETRICSRESPONSE']._serialized_start=188
|
||||||
_globals['_WORKOUTMETRICSRESPONSE']._serialized_end=282
|
_globals['_WORKOUTMETRICSRESPONSE']._serialized_end=316
|
||||||
_globals['_CPREQUEST']._serialized_start=284
|
_globals['_CPREQUEST']._serialized_start=318
|
||||||
_globals['_CPREQUEST']._serialized_end=345
|
_globals['_CPREQUEST']._serialized_end=379
|
||||||
_globals['_CPRESPONSE']._serialized_start=347
|
_globals['_CPRESPONSE']._serialized_start=381
|
||||||
_globals['_CPRESPONSE']._serialized_end=407
|
_globals['_CPRESPONSE']._serialized_end=441
|
||||||
_globals['_METRICS']._serialized_start=410
|
_globals['_METRICS']._serialized_start=444
|
||||||
_globals['_METRICS']._serialized_end=609
|
_globals['_METRICS']._serialized_end=643
|
||||||
# @@protoc_insertion_point(module_scope)
|
# @@protoc_insertion_point(module_scope)
|
||||||
|
|||||||
@@ -1,9 +1,29 @@
|
|||||||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
||||||
"""Client and server classes corresponding to protobuf-defined services."""
|
"""Client and server classes corresponding to protobuf-defined services."""
|
||||||
import grpc
|
import grpc
|
||||||
|
import warnings
|
||||||
|
|
||||||
import rowers.rowing_workout_metrics_pb2 as rowing__workout__metrics__pb2
|
import rowers.rowing_workout_metrics_pb2 as rowing__workout__metrics__pb2
|
||||||
|
|
||||||
|
GRPC_GENERATED_VERSION = '1.70.0'
|
||||||
|
GRPC_VERSION = grpc.__version__
|
||||||
|
_version_not_supported = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
from grpc._utilities import first_version_is_lower
|
||||||
|
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
||||||
|
except ImportError:
|
||||||
|
_version_not_supported = True
|
||||||
|
|
||||||
|
if _version_not_supported:
|
||||||
|
raise RuntimeError(
|
||||||
|
f'The grpc package installed is at version {GRPC_VERSION},'
|
||||||
|
+ f' but the generated code in rowing_workout_metrics_pb2_grpc.py depends on'
|
||||||
|
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
||||||
|
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
||||||
|
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class MetricsStub(object):
|
class MetricsStub(object):
|
||||||
"""OTW-metrics service definition
|
"""OTW-metrics service definition
|
||||||
@@ -19,12 +39,12 @@ class MetricsStub(object):
|
|||||||
'/rowing_workout_metrics.Metrics/CalcMetrics',
|
'/rowing_workout_metrics.Metrics/CalcMetrics',
|
||||||
request_serializer=rowing__workout__metrics__pb2.WorkoutMetricsRequest.SerializeToString,
|
request_serializer=rowing__workout__metrics__pb2.WorkoutMetricsRequest.SerializeToString,
|
||||||
response_deserializer=rowing__workout__metrics__pb2.WorkoutMetricsResponse.FromString,
|
response_deserializer=rowing__workout__metrics__pb2.WorkoutMetricsResponse.FromString,
|
||||||
)
|
_registered_method=True)
|
||||||
self.GetCP = channel.unary_unary(
|
self.GetCP = channel.unary_unary(
|
||||||
'/rowing_workout_metrics.Metrics/GetCP',
|
'/rowing_workout_metrics.Metrics/GetCP',
|
||||||
request_serializer=rowing__workout__metrics__pb2.CPRequest.SerializeToString,
|
request_serializer=rowing__workout__metrics__pb2.CPRequest.SerializeToString,
|
||||||
response_deserializer=rowing__workout__metrics__pb2.CPResponse.FromString,
|
response_deserializer=rowing__workout__metrics__pb2.CPResponse.FromString,
|
||||||
)
|
_registered_method=True)
|
||||||
|
|
||||||
|
|
||||||
class MetricsServicer(object):
|
class MetricsServicer(object):
|
||||||
@@ -60,6 +80,7 @@ def add_MetricsServicer_to_server(servicer, server):
|
|||||||
generic_handler = grpc.method_handlers_generic_handler(
|
generic_handler = grpc.method_handlers_generic_handler(
|
||||||
'rowing_workout_metrics.Metrics', rpc_method_handlers)
|
'rowing_workout_metrics.Metrics', rpc_method_handlers)
|
||||||
server.add_generic_rpc_handlers((generic_handler,))
|
server.add_generic_rpc_handlers((generic_handler,))
|
||||||
|
server.add_registered_method_handlers('rowing_workout_metrics.Metrics', rpc_method_handlers)
|
||||||
|
|
||||||
|
|
||||||
# This class is part of an EXPERIMENTAL API.
|
# This class is part of an EXPERIMENTAL API.
|
||||||
@@ -78,11 +99,21 @@ class Metrics(object):
|
|||||||
wait_for_ready=None,
|
wait_for_ready=None,
|
||||||
timeout=None,
|
timeout=None,
|
||||||
metadata=None):
|
metadata=None):
|
||||||
return grpc.experimental.unary_unary(request, target, '/rowing_workout_metrics.Metrics/CalcMetrics',
|
return grpc.experimental.unary_unary(
|
||||||
|
request,
|
||||||
|
target,
|
||||||
|
'/rowing_workout_metrics.Metrics/CalcMetrics',
|
||||||
rowing__workout__metrics__pb2.WorkoutMetricsRequest.SerializeToString,
|
rowing__workout__metrics__pb2.WorkoutMetricsRequest.SerializeToString,
|
||||||
rowing__workout__metrics__pb2.WorkoutMetricsResponse.FromString,
|
rowing__workout__metrics__pb2.WorkoutMetricsResponse.FromString,
|
||||||
options, channel_credentials,
|
options,
|
||||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
channel_credentials,
|
||||||
|
insecure,
|
||||||
|
call_credentials,
|
||||||
|
compression,
|
||||||
|
wait_for_ready,
|
||||||
|
timeout,
|
||||||
|
metadata,
|
||||||
|
_registered_method=True)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def GetCP(request,
|
def GetCP(request,
|
||||||
@@ -95,8 +126,18 @@ class Metrics(object):
|
|||||||
wait_for_ready=None,
|
wait_for_ready=None,
|
||||||
timeout=None,
|
timeout=None,
|
||||||
metadata=None):
|
metadata=None):
|
||||||
return grpc.experimental.unary_unary(request, target, '/rowing_workout_metrics.Metrics/GetCP',
|
return grpc.experimental.unary_unary(
|
||||||
|
request,
|
||||||
|
target,
|
||||||
|
'/rowing_workout_metrics.Metrics/GetCP',
|
||||||
rowing__workout__metrics__pb2.CPRequest.SerializeToString,
|
rowing__workout__metrics__pb2.CPRequest.SerializeToString,
|
||||||
rowing__workout__metrics__pb2.CPResponse.FromString,
|
rowing__workout__metrics__pb2.CPResponse.FromString,
|
||||||
options, channel_credentials,
|
options,
|
||||||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
|
channel_credentials,
|
||||||
|
insecure,
|
||||||
|
call_credentials,
|
||||||
|
compression,
|
||||||
|
wait_for_ready,
|
||||||
|
timeout,
|
||||||
|
metadata,
|
||||||
|
_registered_method=True)
|
||||||
|
|||||||
@@ -1639,6 +1639,7 @@ def handle_calctrimp(id,
|
|||||||
hrftp,
|
hrftp,
|
||||||
hrmax,
|
hrmax,
|
||||||
hrmin,
|
hrmin,
|
||||||
|
wps_avg,
|
||||||
debug=False, **kwargs):
|
debug=False, **kwargs):
|
||||||
|
|
||||||
|
|
||||||
@@ -1648,6 +1649,7 @@ def handle_calctrimp(id,
|
|||||||
hrtss = 0
|
hrtss = 0
|
||||||
normv = 0
|
normv = 0
|
||||||
normw = 0
|
normw = 0
|
||||||
|
spmtss = 0
|
||||||
|
|
||||||
# check what the real file name is
|
# check what the real file name is
|
||||||
if os.path.exists(csvfilename):
|
if os.path.exists(csvfilename):
|
||||||
@@ -1680,6 +1682,7 @@ def handle_calctrimp(id,
|
|||||||
hrftp=hrftp,
|
hrftp=hrftp,
|
||||||
hrmax=hrmax,
|
hrmax=hrmax,
|
||||||
hrmin=hrmin,
|
hrmin=hrmin,
|
||||||
|
wpsavg=wps_avg,
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
response = stub.CalcMetrics(req, timeout=60)
|
response = stub.CalcMetrics(req, timeout=60)
|
||||||
@@ -1693,13 +1696,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','File {csvfile}. Got tss {tss}, normp {normp} trimp {trimp} normv {normv} normw {normw} hrtss {hrtss}'.format(
|
spmtss = response.spmtss
|
||||||
|
dologging('metrics.log','File {csvfile}. Got tss {tss}, normp {normp} trimp {trimp} normv {normv} normw {normw} hrtss {hrtss} spmtss {spmtss}'.format(
|
||||||
tss = tss,
|
tss = tss,
|
||||||
normp = normp,
|
normp = normp,
|
||||||
trimp = trimp,
|
trimp = trimp,
|
||||||
normv = normv,
|
normv = normv,
|
||||||
normw = normw,
|
normw = normw,
|
||||||
hrtss = hrtss,
|
hrtss = hrtss,
|
||||||
|
spmtss = spmtss,
|
||||||
csvfile=csvfile,
|
csvfile=csvfile,
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -1740,6 +1745,9 @@ def handle_calctrimp(id,
|
|||||||
if hrtss > 1000: # pragma: no cover
|
if hrtss > 1000: # pragma: no cover
|
||||||
hrtss = 0
|
hrtss = 0
|
||||||
|
|
||||||
|
if spmtss > 1000: # pragma: no cover
|
||||||
|
spmtss = 0
|
||||||
|
|
||||||
try:
|
try:
|
||||||
workout = Workout.objects.get(id=id)
|
workout = Workout.objects.get(id=id)
|
||||||
except Workout.DoesNotExist: # pragma: no cover
|
except Workout.DoesNotExist: # pragma: no cover
|
||||||
@@ -1752,6 +1760,7 @@ def handle_calctrimp(id,
|
|||||||
workout.hrtss = int(hrtss)
|
workout.hrtss = int(hrtss)
|
||||||
workout.normv = normv
|
workout.normv = normv
|
||||||
workout.normw = normw
|
workout.normw = normw
|
||||||
|
workout.spmtss = int(spmtss)
|
||||||
workout.save()
|
workout.save()
|
||||||
dologging('metrics.log','Saving to workout {id} {obscure}'.format(
|
dologging('metrics.log','Saving to workout {id} {obscure}'.format(
|
||||||
id = id,
|
id = id,
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
<p>TRIMP: TRaining IMPact. A way to combine duration and heart rate into a single number.</p>
|
<p>TRIMP: TRaining IMPact. A way to combine duration and heart rate into a single number.</p>
|
||||||
<p>rScore: Score based on rPower and workout duration to estimate training effect</p>
|
<p>rScore: Score based on rPower and workout duration to estimate training effect</p>
|
||||||
<p>rScore (HR): Score based on heart rate, designed to give values comparable to rScore. Used instead of rScore for workouts without power data.</p>
|
<p>rScore (HR): Score based on heart rate, designed to give values comparable to rScore. Used instead of rScore for workouts without power data.</p>
|
||||||
|
<p>rScore (SPM): Score based on stroke rate, designed to give values comparable to rScore. Used instead of rScore for workouts without power or heart rate data.</p>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -1035,8 +1035,15 @@ def strokedatajson_v2(request, id):
|
|||||||
datadf = dataprep.dataplep(
|
datadf = dataprep.dataplep(
|
||||||
rowdata, id=row.id, bands=True, barchart=True, otwpower=True, empower=True)
|
rowdata, id=row.id, bands=True, barchart=True, otwpower=True, empower=True)
|
||||||
|
|
||||||
|
if row.workouttype in mytypes.otwtypes:
|
||||||
|
wps_avg = r.median_wps
|
||||||
|
elif row.workouttype in mytypes.ergtypes:
|
||||||
|
wps_avg = r.median_wps_erg
|
||||||
|
else:
|
||||||
|
wps_avg = 0
|
||||||
|
|
||||||
_ = myqueue(queuehigh, handle_calctrimp, row.id,
|
_ = myqueue(queuehigh, handle_calctrimp, row.id,
|
||||||
row.csvfilename, r.ftp, r.sex, r.hrftp, r.max, r.rest)
|
row.csvfilename, r.ftp, r.sex, r.hrftp, r.max, r.rest, wps_avg)
|
||||||
|
|
||||||
isbreakthrough, ishard = dataprep.checkbreakthrough(row, r)
|
isbreakthrough, ishard = dataprep.checkbreakthrough(row, r)
|
||||||
|
|
||||||
|
|||||||
@@ -3758,6 +3758,9 @@ def workout_stats_view(request, id=0, message="", successmessage=""):
|
|||||||
# TRIMP
|
# TRIMP
|
||||||
trimp, hrtss = dataprep.workout_trimp(w)
|
trimp, hrtss = dataprep.workout_trimp(w)
|
||||||
|
|
||||||
|
# SPMTSS
|
||||||
|
spmtss = dataprep.workout_spmtss(w)
|
||||||
|
|
||||||
otherstats['trimp'] = {
|
otherstats['trimp'] = {
|
||||||
'verbose_name': 'TRIMP',
|
'verbose_name': 'TRIMP',
|
||||||
'value': int(trimp),
|
'value': int(trimp),
|
||||||
@@ -3770,6 +3773,12 @@ def workout_stats_view(request, id=0, message="", successmessage=""):
|
|||||||
'unit': ''
|
'unit': ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
otherstats['spmScore'] = {
|
||||||
|
'verbose_name': 'rScore (SPM)',
|
||||||
|
'value': int(spmtss),
|
||||||
|
'unit': ''
|
||||||
|
}
|
||||||
|
|
||||||
return render(request,
|
return render(request,
|
||||||
'workoutstats.html',
|
'workoutstats.html',
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user