Delete VPS document stage after verified local storage sync
This commit is contained in:
@@ -7,6 +7,7 @@ from sqlalchemy import func, or_, select
|
||||
from sqlalchemy.orm import Session, selectinload
|
||||
|
||||
from app.modules.clients.models import Client
|
||||
from app.modules.alerts.workflow_escalations import list_workflow_escalations
|
||||
from app.modules.core.iam.models import User
|
||||
from app.modules.core.rbac.models import Permission, Role, RolePermission, UserRole
|
||||
from app.modules.employees.service import (
|
||||
@@ -385,6 +386,7 @@ def build_manager_dashboard_payload(db: Session, request, current_user) -> dict[
|
||||
staff_rows = _staff_rows(db, scope, task_rows)
|
||||
client_rows = _client_rows(db, scope, task_rows)
|
||||
advanced_engagements = _advanced_engagement_rows(tasks)
|
||||
unified_escalations = list_workflow_escalations(db, tenant_id=getattr(scope, "tenant_id", None), branch_id=getattr(scope, "branch_id", None), assigned_to_user_id=current_user.id)
|
||||
capacity_rows = _capacity_rows(tasks)
|
||||
sla_breached = [row for row in advanced_engagements if row["sla"]["status"] == "breached"]
|
||||
sla_warning = [row for row in advanced_engagements if row["sla"]["status"] in {"critical", "warning"}]
|
||||
@@ -430,6 +432,8 @@ def build_manager_dashboard_payload(db: Session, request, current_user) -> dict[
|
||||
"staff_count": len(staff_rows),
|
||||
"client_count": len(client_rows),
|
||||
"escalation_count": len(escalation_rows),
|
||||
"unified_escalation_count": len(unified_escalations),
|
||||
"escalations_over_3_days": len([r for r in unified_escalations if r["age_days"] >= 3]),
|
||||
"engagement_count": len(advanced_engagements),
|
||||
"sla_breached_count": len(sla_breached),
|
||||
"sla_warning_count": len(sla_warning),
|
||||
@@ -451,6 +455,7 @@ def build_manager_dashboard_payload(db: Session, request, current_user) -> dict[
|
||||
"client_pending": client_pending_rows[:60],
|
||||
"documents_pending": client_pending_rows[:40],
|
||||
"escalations": escalation_rows[:80],
|
||||
"unified_escalations": unified_escalations,
|
||||
"age_buckets": age_buckets,
|
||||
"status_summary": sorted([{"label": k, "count": v} for k, v in status_summary.items()], key=lambda x: x["count"], reverse=True)[:10],
|
||||
"service_summary": sorted([{"label": k, "count": v} for k, v in service_summary.items()], key=lambda x: x["count"], reverse=True)[:10],
|
||||
|
||||
Reference in New Issue
Block a user