feat: add KS-3/payments, tech debt fixes, UI polish, and KS-2 Excel/Word export
Tasks 008-016: KS-6a journal, KS-3 documents, payments with allocations, tech debt cleanup, financial privacy, document tree, storno mechanism, row-click UI, BOQ collapse/sticky header, and KS-2 export to Excel/Word via shared DTO architecture.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import shutil
|
||||
from decimal import Decimal
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
@@ -7,10 +8,13 @@ from sqlalchemy.orm import sessionmaker
|
||||
|
||||
from app.database.database import Base, DATABASE_PATH
|
||||
from app.main import app
|
||||
from app.models.boq import WorkItem
|
||||
from app.models.daily_report import DailyReport, DailyReportItem
|
||||
from app.models.work_journal import WorkJournalEntry
|
||||
from app.models.project import Project
|
||||
from app.routers import projects
|
||||
from app.services.project_dashboard import build_project_dashboard
|
||||
from app.services.effective_plan import build_effective_plan
|
||||
|
||||
|
||||
def test_project_work_journal_crud_and_dashboard_warnings(tmp_path):
|
||||
@@ -29,6 +33,23 @@ def test_project_work_journal_crud_and_dashboard_warnings(tmp_path):
|
||||
|
||||
app.dependency_overrides[projects.get_db] = override_db
|
||||
try:
|
||||
# Create over-plan data so dashboard warnings are deterministic
|
||||
with TestingSession() as session:
|
||||
eff = build_effective_plan(session, 2)
|
||||
target_item = None
|
||||
for row in eff["items"]:
|
||||
if row.quantity > 0 and row.item.system_id is not None:
|
||||
target_item = row.item
|
||||
break
|
||||
assert target_item is not None
|
||||
over_qty = Decimal(str(target_item.quantity)) + Decimal("5")
|
||||
dr = DailyReport(project_id=2, report_date=__import__("datetime").date(2026, 9, 1), system_id=target_item.system_id)
|
||||
session.add(dr)
|
||||
session.flush()
|
||||
dri = DailyReportItem(daily_report_id=dr.id, work_item_id=target_item.id, completed_quantity=over_qty)
|
||||
session.add(dri)
|
||||
session.commit()
|
||||
|
||||
with TestClient(app) as client:
|
||||
dashboard = client.get("/projects/2")
|
||||
assert dashboard.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user