Универсальная функция просмотра отчётов

This commit is contained in:
2024-11-20 22:40:16 +03:00
parent 5c8bf9b585
commit 54cf175b00
2 changed files with 3 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
from flask import request, Blueprint, render_template, session, url_for
from checker import check_auth
from os import path
from .report_model import sales_report, make_report
from .report_model import view_report, make_report
import json
with open(path.join(path.dirname(__file__), 'reports.json')) as f:
@@ -56,7 +56,7 @@ def view():
report_access = json.load(f)
if session['role'] in report_access['read']:
ready_report = sales_report(data, report_access['view'])
ready_report = view_report(data, report_access['view'])
if ready_report.status:
title= f'{report_access["title"]} за {data["month"]}-{data["year"]}'
return render_template("output.html", items=ready_report.result,

View File

@@ -18,7 +18,7 @@ def check_report(input_data: dict) -> bool:
return False
return True
def sales_report(input_data: dict, view_script: str) -> InfoRespronse:
def view_report(input_data: dict, view_script: str) -> InfoRespronse:
status = check_report(input_data)
if not status:
return InfoRespronse((),