Private
Public Access
1
0

now seems to behave

This commit is contained in:
Sander Roosendaal
2021-03-01 11:56:48 +01:00
parent 0d86b0d662
commit b1a9736aea
6 changed files with 11 additions and 13 deletions

View File

@@ -184,7 +184,7 @@ ratelim==0.1.6
redis==3.5.3
requests==2.23.0
requests-oauthlib==1.2.0
rowingdata==3.1.4
rowingdata==3.1.8
rowingphysics==0.5.0
rq==0.13.0
rules==2.1

View File

@@ -2359,7 +2359,6 @@ class PlannedSession(models.Model):
dct = trainingparser.parsetodict(self.interval_string)
dct = [item for item in dct if item['value'] != 0]
dct = trainingparser.tofitdict(dct)
print(dct)
self.steps = dct
@@ -2414,14 +2413,14 @@ class PlannedSession(models.Model):
if self.steps and not self.fitfile:
if self.pk is not None:
filename = settings.MEDIA_ROOT+'/session'+encoder.encode_hex(self.pk)+'.fit'
filename = 'session'+encoder.encode_hex(self.pk)+'.fit'
else:
file = tempfile.NamedTemporaryFile(mode='w+b',suffix='.fit',dir=settings.MEDIA_ROOT)
filename = file.name
steps = self.steps
steps['filename'] = filename
fitfile = steps_write_fit(steps)
self.fitfile = fitfile
self.fitfile.name = fitfile
super(PlannedSession,self).save(*args, **kwargs)

View File

@@ -184,7 +184,10 @@ def step_to_string(step):
#
targettype = step['targetType']
try:
targettype = step['targetType']
except KeyError:
targettype = None
if targettype == 'HeartRate':
value = step['targetValue']

View File

@@ -926,7 +926,7 @@ def mocked_requests(*args, **kwargs):
"refresh_token": "1234567898765432112345678987654321",
"expires_at": arrow.now().timestamp()+7200
}
print(arrow.now().timestamp()+3600)
return MockResponse(json_data,200)

View File

@@ -13,10 +13,9 @@ from rq.job import Job
def download_fit(request,filename=''):
r = getrower(request.user)
pss = PlannedSession.objects.filter(fitfile=filename)
print(filename,pss)
if len(pss) != 1:
raise Http404("Could not find the required file")

View File

@@ -447,9 +447,6 @@ def plannedsession_create_view(request,
interval_string = cd['interval_string']
fitfile = cd['fitfile']
if sessionunit == 'min':
sessionmode = 'time'
elif sessionunit in ['km','m']:
@@ -476,7 +473,7 @@ def plannedsession_create_view(request,
if sessioncreateform.cleaned_data['fitfile']:
f = sessioncreateform.cleaned_data['fitfile']
filename, path_and_filename = handle_uploaded_file(f)
ps.fitfile.name = filename
ps.fitfile = filename
ps.save()
add_rower_session(r,ps)