diff --git a/src/hct_mis_api/apps/dashboard/celery_tasks.py b/src/hct_mis_api/apps/dashboard/celery_tasks.py index 3e2ffa36a3..1fb78904df 100644 --- a/src/hct_mis_api/apps/dashboard/celery_tasks.py +++ b/src/hct_mis_api/apps/dashboard/celery_tasks.py @@ -38,7 +38,7 @@ def generate_dash_report_task(self: Any, business_area_slug: str) -> None: Celery task to refresh dashboard data for a specific business area. """ try: - business_area = BusinessArea.objects.get(slug=business_area_slug) + business_area = BusinessArea.objects.using("read_only").get(slug=business_area_slug) set_sentry_business_area_tag(business_area.slug) DashboardDataCache.refresh_data(business_area.slug) diff --git a/src/hct_mis_api/apps/dashboard/services.py b/src/hct_mis_api/apps/dashboard/services.py index dc564b4369..c6391972e0 100644 --- a/src/hct_mis_api/apps/dashboard/services.py +++ b/src/hct_mis_api/apps/dashboard/services.py @@ -81,7 +81,13 @@ def refresh_data(cls, business_area_slug: str) -> ReturnDict: "financial_service_provider", "delivery_type", ) - .filter(business_area=area, household__is_removed=False, parent__status__in=["ACCEPTED", "FINISHED"]) + .filter( + business_area=area, + household__is_removed=False, + parent__status__in=["ACCEPTED", "FINISHED"], + is_removed=False, + conflicted=False, + ) # noqa .exclude(status__in=["Transaction Erroneous", "Not Distributed", "Force failed", "Manually Cancelled"]) .annotate( year=ExtractYear(Coalesce("delivery_date", "entitlement_date", "status_date")), diff --git a/src/hct_mis_api/apps/steficon/admin.py b/src/hct_mis_api/apps/steficon/admin.py index b4cdb9e6ff..abca98ec6f 100644 --- a/src/hct_mis_api/apps/steficon/admin.py +++ b/src/hct_mis_api/apps/steficon/admin.py @@ -235,6 +235,7 @@ class RuleAdmin(SyncMixin, ImportExportMixin, TestRuleMixin, LinkedObjectsMixin, change_form_template = None change_list_template = None resource_class = RuleResource + date_hierarchy = "created_at" fieldsets = [ ( None, @@ -538,7 +539,7 @@ class Meta: @register(RuleCommit) class RuleCommitAdmin(ImportExportMixin, LinkedObjectsMixin, TestRuleMixin, HOPEModelAdminBase): - list_display = ("timestamp", "rule", "version", "updated_by", "is_release", "enabled", "deprecated") + list_display = ("rule", "version", "updated_by", "timestamp", "is_release", "enabled", "deprecated") list_filter = (("rule", AutoCompleteFilter), "is_release", "enabled", "deprecated") search_fields = ("rule__name",) readonly_fields = ("updated_by",) @@ -557,6 +558,7 @@ class RuleCommitAdmin(ImportExportMixin, LinkedObjectsMixin, TestRuleMixin, HOPE "affected_fields", "updated_by", ) + date_hierarchy = "timestamp" def get_readonly_fields(self, request: HttpRequest, obj: Optional[RuleCommit] = None) -> List[str]: if is_root(request):