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