last item is b param

This commit is contained in:
Josh Burman
2021-11-30 19:55:30 +00:00
parent 5a35d47391
commit 3e708c0137

View File

@ -12,18 +12,22 @@ def items_csv_to_dict(items_csv_reader):
headers = row
else:
item = { 'attributes': [] }
count = 0
for key, col in enumerate(headers):
if key == 0:
item[col] = row[key]
elif col == 'b_param':
item[col] = float(row[key])
item[col] = row[key]
elif key > 1:
item['attributes'].append({
'id': col,
'value': row[key],
'type': 'metadata'
})
elif count == (1 - len(headers.split(','))):
item['b_param'] = float(row[key])
count += 1
items.append(item)