Separate price and currency

main
Bob Mottram 2021-07-28 10:56:28 +01:00
parent 8cd539fe8f
commit ef606161a1
1 changed files with 3 additions and 2 deletions

View File

@ -963,7 +963,7 @@ def sharesCatalogCSVEndpoint(baseDir: str, httpPrefix: str,
return '' return ''
csvStr = \ csvStr = \
'id,type,hasType,startDate,expiryDate,' + \ 'id,type,hasType,startDate,expiryDate,' + \
'quantity,price,Image,description,\r\n' 'quantity,price,currency,Image,description,\r\n'
for item in catalogJson['DFC:supplies']: for item in catalogJson['DFC:supplies']:
csvStr += '"' + item['@id'] + '",' csvStr += '"' + item['@id'] + '",'
csvStr += '"' + item['@type'] + '",' csvStr += '"' + item['@type'] + '",'
@ -971,7 +971,8 @@ def sharesCatalogCSVEndpoint(baseDir: str, httpPrefix: str,
csvStr += '"' + item['DFC:startDate'] + '",' csvStr += '"' + item['DFC:startDate'] + '",'
csvStr += '"' + item['DFC:expiryDate'] + '",' csvStr += '"' + item['DFC:expiryDate'] + '",'
csvStr += str(item['DFC:quantity']) + ',' csvStr += str(item['DFC:quantity']) + ','
csvStr += item['DFC:price'] + ',' csvStr += item['DFC:price'].split(' ')[0] + ','
csvStr += '"' + item['DFC:price'].split(' ')[1] + '",'
csvStr += '"' + item['DFC:Image'] + '",' csvStr += '"' + item['DFC:Image'] + '",'
description = item['DFC:description'].replace('"', "'") description = item['DFC:description'].replace('"', "'")
csvStr += '"' + description + '",\r\n' csvStr += '"' + description + '",\r\n'