better way to b param

This commit is contained in:
Josh Burman 2021-11-30 20:35:23 +00:00
parent 13448fb73a
commit 1649f5cee1

View File

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