Update app.py
Browse files
app.py
CHANGED
|
@@ -1078,10 +1078,10 @@ def summaryClick(seshid):
|
|
| 1078 |
print('summaryClick -- counts_totals: ', all_counts, all_totals, sesh.counts_totals)
|
| 1079 |
if sesh.summary_closed:
|
| 1080 |
sesh.summary_closed = False
|
| 1081 |
-
store_data = {store: (lambda data: '' if not data or store.split()[0].lower() not in data[0]['STORE'].lower() or 'ZIPCODE' not in data[0] or 'PHONE' not in data[0] or 'STATE' not in data[0] or data[0]['STATE'] != sesh.state or len(data[0]['STATE']) != 2 or len(data[0]['PHONE']) != 12 else '\n'.join(['\n'.join([('\t\t\t'+key if key.lower() != 'store' else '\t\tNAME')+': '+value for key,value in d.items()]) for d in data]))(retrieveProcessedStoreData(store)) for store in sesh.summary_joined}
|
| 1082 |
-
#store_data = {store: (lambda data: '' if not data or 'zipcode' not in data[0] else '\n'.join([str(d) for d in data]))(retrieveProcessedStoreData(store)) for store in sesh.summary_joined}
|
| 1083 |
item_summary_data = '\n\n'.join(['STORE: '+store+'\n'+('\tLOCATIONS: N/A' if not store_data[store] else '\tLOCATIONS: \n'+store_data[store])+''.join(['\n\tPRODUCT: '+ product +'\n\tPRICE: '+pd_count['product_dict']['price']+'\n\tSOURCE: '+pd_count['product_dict']['href'] for product,pd_count in sesh.summary_joined[store].items()]) for store in sesh.summary_joined])
|
| 1084 |
-
print('store summary: ', {store: retrieveProcessedStoreData(store) for store in sesh.summary_joined})
|
| 1085 |
setSesh(seshid, sesh)
|
| 1086 |
return gr.Button('Suppress Summary'), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.Dropdown(list(sesh.summary_joined), label='Merchants', interactive=True), gr.Label('All', label='Merchant'), gr.Label(all_counts, label='Number of Items'), gr.Label('$'+str(np.round(all_totals, 2)), label='Total'), item_summary_data
|
| 1087 |
|
|
|
|
| 1078 |
print('summaryClick -- counts_totals: ', all_counts, all_totals, sesh.counts_totals)
|
| 1079 |
if sesh.summary_closed:
|
| 1080 |
sesh.summary_closed = False
|
| 1081 |
+
store_data = {store: (lambda data: '' if not data or store.split()[0].lower() not in data[0]['STORE'].lower() or 'ZIPCODE' not in data[0] or 'PHONE' not in data[0] or 'STATE' not in data[0] or data[0]['STATE'] != sesh.state or len(data[0]['STATE']) != 2 or len(data[0]['PHONE']) != 12 else '\n'.join(['\n'.join([('\t\t\t'+key if key.lower() != 'store' else '\t\tNAME')+': '+value for key,value in d.items()]) for d in data]))(retrieveProcessedStoreData(store, )) for store in sesh.summary_joined}
|
| 1082 |
+
#store_data = {store: (lambda data: '' if not data or 'zipcode' not in data[0] else '\n'.join([str(d) for d in data]))(retrieveProcessedStoreData(store, seshid)) for store in sesh.summary_joined}
|
| 1083 |
item_summary_data = '\n\n'.join(['STORE: '+store+'\n'+('\tLOCATIONS: N/A' if not store_data[store] else '\tLOCATIONS: \n'+store_data[store])+''.join(['\n\tPRODUCT: '+ product +'\n\tPRICE: '+pd_count['product_dict']['price']+'\n\tSOURCE: '+pd_count['product_dict']['href'] for product,pd_count in sesh.summary_joined[store].items()]) for store in sesh.summary_joined])
|
| 1084 |
+
print('store summary: ', {store: retrieveProcessedStoreData(store, seshid) for store in sesh.summary_joined})
|
| 1085 |
setSesh(seshid, sesh)
|
| 1086 |
return gr.Button('Suppress Summary'), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.update(visible=bool(0)), gr.update(visible=bool(0)), gr.update(visible=bool(1)), gr.Dropdown(list(sesh.summary_joined), label='Merchants', interactive=True), gr.Label('All', label='Merchant'), gr.Label(all_counts, label='Number of Items'), gr.Label('$'+str(np.round(all_totals, 2)), label='Total'), item_summary_data
|
| 1087 |
|