fixing steps dictionary
This commit is contained in:
@@ -2367,6 +2367,14 @@ class PlannedSession(models.Model):
|
|||||||
dct = trainingparser.parsetodict(self.interval_string)
|
dct = trainingparser.parsetodict(self.interval_string)
|
||||||
dct = [item for item in dct if item['value'] != 0]
|
dct = [item for item in dct if item['value'] != 0]
|
||||||
dct = trainingparser.tofitdict(dct)
|
dct = trainingparser.tofitdict(dct)
|
||||||
|
for step in dct['steps']:
|
||||||
|
try:
|
||||||
|
step['targetValue'] = int(step['targetValue'])
|
||||||
|
step['targetValueLow'] = int(step['targetValueHigh'])
|
||||||
|
step['targetValueHigh'] = int(step['targetValueLow'])
|
||||||
|
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
self.steps = dct
|
self.steps = dct
|
||||||
|
|
||||||
# sort units
|
# sort units
|
||||||
@@ -2413,12 +2421,13 @@ class PlannedSession(models.Model):
|
|||||||
if self.steps and not self.fitfile:
|
if self.steps and not self.fitfile:
|
||||||
filename = 'aap.fit'
|
filename = 'aap.fit'
|
||||||
filename = get_file_path(self,filename)
|
filename = get_file_path(self,filename)
|
||||||
|
|
||||||
steps = self.steps
|
steps = self.steps
|
||||||
steps['filename'] = os.path.join(settings.MEDIA_ROOT,filename)
|
steps['filename'] = os.path.join(settings.MEDIA_ROOT,filename)
|
||||||
fitfile = steps_write_fit(steps)
|
fitfile = steps_write_fit(steps)
|
||||||
self.fitfile.name = filename
|
self.fitfile.name = filename
|
||||||
self.steps = steps
|
self.steps = steps
|
||||||
print(self.fitfile.name,filename)
|
|
||||||
|
|
||||||
# calculate approximate distance
|
# calculate approximate distance
|
||||||
if self.steps:
|
if self.steps:
|
||||||
|
|||||||
Reference in New Issue
Block a user