Synchronise approved AQMM across staff and review boards
This commit is contained in:
@@ -17,7 +17,7 @@ from app.modules.employees.service import (
|
||||
_engagement_team,
|
||||
_weighted_progress,
|
||||
)
|
||||
from app.modules.services.execution import CLOSED_TASK_STATUSES
|
||||
from app.modules.services.execution import CLOSED_TASK_STATUSES, synchronise_approved_engagement_acceptance_tasks
|
||||
from app.modules.services.models import ClientServiceSubscription, ClientServiceTaskInstance, ServiceCatalogue, ServiceTaskComment
|
||||
|
||||
MANAGER_ROLES = {"Manager", "Branch Manager", "System Admin", "Firm Admin", "Partner"}
|
||||
@@ -599,6 +599,19 @@ def get_manager_review_workspace(
|
||||
if not tasks:
|
||||
return None
|
||||
|
||||
subscription_for_sync = getattr(tasks[0], "subscription", None)
|
||||
if subscription_for_sync is not None:
|
||||
repaired_setup_rows = synchronise_approved_engagement_acceptance_tasks(
|
||||
db,
|
||||
subscription=subscription_for_sync,
|
||||
actor_user_id=int(current_user.id),
|
||||
)
|
||||
if repaired_setup_rows:
|
||||
db.commit()
|
||||
tasks = list(db.execute(
|
||||
stmt.order_by(ClientServiceTaskInstance.sequence_no.asc(), ClientServiceTaskInstance.id.asc())
|
||||
).scalars().all())
|
||||
|
||||
task_rows = [_manager_review_task_row(task) for task in tasks]
|
||||
reviewable = [row for row in task_rows if row["review_state"] in {"pending_review", "reviewed", "rework"}]
|
||||
pending = [row for row in reviewable if row["review_state"] == "pending_review"]
|
||||
|
||||
Reference in New Issue
Block a user