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 headers = row
else: else:
item = { 'attributes': [] } item = { 'attributes': [] }
count = 0
for key, col in enumerate(headers): for key, col in enumerate(headers):
if key == 0: if key == 0:
item[col] = row[key] item[col] = row[key]
elif col == 'b_param': elif col == 'b_param':
item[col] = float(row[key]) item[col] = row[key]
elif key > 1: elif key > 1:
item['attributes'].append({ item['attributes'].append({
'id': col, 'id': col,
'value': row[key], 'value': row[key],
'type': 'metadata' 'type': 'metadata'
}) })
elif count == (1 - len(headers.split(','))):
item['b_param'] = float(row[key])
count += 1
items.append(item) items.append(item)