All checks were successful
Build and Push Docker Image / build (push) Successful in 4m14s
Reference numbers (unified scheme PREFIX-YYYYMM-HOSP-NNNN, e.g. CMP-202606-HHN-0001): - new ReferenceSequence model + generate_reference() helper (apps/core) - Complaint/Inquiry/Observation/Appreciation/Suggestion emit unified refs via save() - prefix-based auto-routing in public track API (CMP/INQ/OBS trackable; APR/SGT internal-only) - removed legacy CMP-/INQ- generators in ui_views, integrations, px_sources - migrations: core.0003_referencesequence, appreciation.0006, feedback.0008, observations.0012 - unit tests (format, sanitization, monthly reset, 40-thread concurrency) QA audit: - isolated E2E hospital sandbox mirroring HH-N + 10 role users (create_e2e_isolated_env) - feedback-modules-audit.spec.ts + audit helper (headed, run-to-completion) - reports/feedback-modules-qa-report.md Also bundles accumulated in-progress work across complaints, observations, organizations, templates, and other modules.
42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
from django.core.management.base import BaseCommand
|
|
from django.db.models import F
|
|
from apps.complaints.models import Complaint, ComplaintInvolvedDepartment
|
|
from apps.observations.models import Observation
|
|
from apps.complaints.models import Inquiry
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = "Backfill sent_to_department=True on all records that have a department assigned"
|
|
|
|
def handle(self, *args, **options):
|
|
c_updated = Complaint.objects.filter(
|
|
department__isnull=False, sent_to_department=False
|
|
).update(
|
|
sent_to_department=True,
|
|
sent_to_department_at=F("created_at"),
|
|
)
|
|
self.stdout.write(f"Complaints updated: {c_updated}")
|
|
|
|
o_updated = Observation.objects.filter(
|
|
assigned_department__isnull=False, sent_to_department=False
|
|
).update(
|
|
sent_to_department=True,
|
|
sent_to_department_at=F("created_at"),
|
|
)
|
|
self.stdout.write(f"Observations updated: {o_updated}")
|
|
|
|
i_updated = Inquiry.objects.filter(
|
|
department__isnull=False, sent_to_department=False
|
|
).update(
|
|
sent_to_department=True,
|
|
sent_to_department_at=F("created_at"),
|
|
)
|
|
self.stdout.write(f"Inquiries updated: {i_updated}")
|
|
|
|
cid_updated = ComplaintInvolvedDepartment.objects.filter(
|
|
sent=False, complaint__department__isnull=False
|
|
).update(sent=True)
|
|
self.stdout.write(f"Involved departments updated: {cid_updated}")
|
|
|
|
self.stdout.write(self.style.SUCCESS("Done"))
|