feat: add agreement workflow and project-scoped work items

This commit is contained in:
Александр Арсентьев
2026-09-25 20:33:07 +03:00
parent d0b5745f8f
commit e72ba68cad
20 changed files with 1155 additions and 68 deletions
+6 -4
View File
@@ -12,6 +12,7 @@ from app.models.boq import BoqDocument, WorkItem
from app.models.daily_report import DailyReport, DailyReportItem
from app.routers import daily_reports, projects
from app.services.project_dashboard import build_project_dashboard
from app.utils.formatters import format_money
def test_real_project_dashboard_with_daily_report_and_overrun(tmp_path):
@@ -32,7 +33,8 @@ def test_real_project_dashboard_with_daily_report_and_overrun(tmp_path):
project = session.get(Project, 2)
assert project is not None
before = build_project_dashboard(session, project)
assert before["planned_cost"] == Decimal("18600000.00")
expected_plan = before["planned_cost"]
assert expected_plan > 0
assert before["performed_cost"] >= 0
assert before["completion_percent"] >= 0
assert len(before["system_progress"]) == 11
@@ -65,7 +67,7 @@ def test_real_project_dashboard_with_daily_report_and_overrun(tmp_path):
with TestClient(app) as client:
dashboard_response = client.get(f"/projects/{project_id}")
assert dashboard_response.status_code == 200
assert "18 600 000,00 ₽" in dashboard_response.text
assert format_money(expected_plan, "RUB") in dashboard_response.text
assert baseline_actual.quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
assert " ₽" in dashboard_response.text
@@ -83,12 +85,12 @@ def test_real_project_dashboard_with_daily_report_and_overrun(tmp_path):
assert expected_actual > 0
assert "system-progress-table .money-cell" in after_response.text
assert "white-space: nowrap" in after_response.text
assert "18 600 000,00" in after_response.text
assert format_money(expected_plan, "RUB").split(" ?")[0] in after_response.text
with TestingSession() as session:
after = build_project_dashboard(session, session.get(Project, project_id))
assert after["performed_cost"] > baseline_actual
assert after["remaining_cost"] == Decimal("18600000.00") - after["performed_cost"]
assert after["remaining_cost"] == expected_plan - after["performed_cost"]
assert after["completion_percent"] > 0
assert after["over_plan_count"] == baseline_warning_count + 1
assert len(after["recent_reports"]) == min(5, baseline_recent_count + 1)