Кэширование товаров из накладной
This commit is contained in:
@@ -21,11 +21,15 @@ def clear():
|
||||
session.pop('waybill')
|
||||
|
||||
def form_waybill() -> list:
|
||||
db_config = current_app.config['db_config']
|
||||
cache_config = current_app.config['cache_config']
|
||||
|
||||
current_waybill = session.get('waybill',{})
|
||||
waybill = []
|
||||
for k,v in current_waybill.items():
|
||||
_sql = sql_provider.get('one_good.sql', dict(work_id=k))
|
||||
product = select_list(current_app.config['db_config'], _sql)[0]
|
||||
cache_select = fetch_from_cache(f'product_{k}', cache_config)(select_list)
|
||||
product = cache_select(db_config, _sql)[0]
|
||||
product['amount'] = v
|
||||
waybill.append(product)
|
||||
return waybill
|
||||
|
||||
Reference in New Issue
Block a user