Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2021-03-21 13:37:29 +01:00
parent 4b6d4c5072
commit e0770a17e6
2 changed files with 17 additions and 12 deletions

View File

@@ -2430,18 +2430,21 @@ class PlannedSession(models.Model):
# interval string
if self.interval_string:
dct = trainingparser.parsetodict(self.interval_string)
dct = [item for item in dct if item['value'] != 0]
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'])
try:
dct = trainingparser.parsetodict(self.interval_string)
dct = [item for item in dct if item['value'] != 0]
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
except KeyError:
pass
self.steps = dct
except:
pass
# sort units
if self.sessionmode == 'distance':