diff --git a/App/Waybill/model.py b/App/Waybill/model.py index 9d912d4..0f908ef 100644 --- a/App/Waybill/model.py +++ b/App/Waybill/model.py @@ -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