Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dashboard fix 1 #4537

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hct_mis_api/apps/dashboard/celery_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 7 additions & 1 deletion src/hct_mis_api/apps/dashboard/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")),
Expand Down
4 changes: 3 additions & 1 deletion src/hct_mis_api/apps/steficon/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",)
Expand All @@ -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):
Expand Down
Loading