Private
Public Access
1
0

changing nk import to async

This commit is contained in:
Sander Roosendaal
2021-04-21 08:28:09 +02:00
parent 0cbce4df9f
commit c278f7b900
4 changed files with 426 additions and 217 deletions

View File

@@ -50,7 +50,7 @@ def to_time(milliseconds):
def rdata(file,rower=rrower()):
try:
res = rrdata(csvfile=file,rower=rower)
except (IOError, IndexError, EOFError,FileNotFoundError):
except (IOError, IndexError, EOFError,FileNotFoundError): # pragma: no cover
try:
res = rrdata(csvfile=file+'.gz',rower=rower)
except (IOError, IndexError, EOFError,FileNotFoundError):
@@ -85,16 +85,7 @@ from rowers.tasks import (
)
from rowers.utils import totaltime_sec_to_string
# nog niet af
def ps_dict_get_durationdistance(d):
sdict = ps_dict_order(d)
return sdict
def ps_dict_get_description(d,short=False):
def ps_dict_get_description(d,short=False): # pragma: no cover
sdict,totalmeters,totalseconds = ps_dict_order(d,short=short)
s = ''
for item in sdict:
@@ -115,35 +106,6 @@ def ps_dict_get_description_html(d,short=False):
return s
class FitWorkoutSteps(object):
def __init__(self,json_string,name='',sport='Custom'):
self.json = json_string
self.steps = json.loads(json_string)
self.name = name
self.sport = sport
# message 0 is file id
# message 1 must be workout description
def to_json(self):
d = self.get_dict()
return json.dumps(d)
def get_dict(self):
return self.steps
def get_description(self):
s = ''
for step in self.steps:
s += step_to_string(step)
s += '\n'
return s
def checkscores(r,macrocycles):
for m in macrocycles:
createmesofillers(m)
@@ -246,7 +208,7 @@ def get_execution_report(rower,startdate,enddate,plan=None):
mesos = TrainingMesoCycle.objects.filter(plan__in=macros).order_by("startdate")
micros = TrainingMicroCycle.objects.filter(plan__in=mesos).order_by("startdate")
micros = micros.exclude(enddate__lte=startdate).exclude(startdate__gte=enddate)
else:
else: # pragma: no cover
plans = TrainingPlan.objects.filter(startdate__lte=startdate,enddate__gte=startdate)
plans2 = TrainingPlan.objects.filter(enddate__lte=enddate,startdate__lte=enddate)
plans = plans | plans2