From 8b3c0e0fcc3de25c3b1c39cc1758dca73185c322 Mon Sep 17 00:00:00 2001 From: Anton Kamalov Date: Thu, 5 Dec 2024 23:18:52 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D1=8D=D1=88=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=82=D0=BE=D0=B2=D0=B0=D1=80=D0=BE?= =?UTF-8?q?=D0=B2=20=D0=B8=D0=B7=20=D0=BD=D0=B0=D0=BA=D0=BB=D0=B0=D0=B4?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App/Waybill/model.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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