Skip to content

Commit

Permalink
Merge pull request #35057 from dimagi/jc/fix-unsaved-favorites-reports
Browse files Browse the repository at this point in the history
Fix saved report for data forwarding records being deleted
  • Loading branch information
jingcheng16 authored Sep 2, 2024
2 parents d94b02e + 2fc2c91 commit b83e31d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion corehq/apps/saved_reports/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
)
from corehq.apps.reports.dispatcher import (
CustomProjectReportDispatcher,
DomainReportDispatcher,
ProjectReportDispatcher,
ReleaseManagementReportDispatcher,
)
Expand Down Expand Up @@ -203,7 +204,8 @@ def _dispatcher(self):
CustomProjectReportDispatcher,
EnterpriseReportDispatcher,
ReleaseManagementReportDispatcher,
CaseManagementMapDispatcher
CaseManagementMapDispatcher,
DomainReportDispatcher,
]

for dispatcher in dispatchers:
Expand Down
9 changes: 9 additions & 0 deletions corehq/apps/saved_reports/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ def test_report_config_does_not_have_datespan_if_not_in_params(self):
self.assertEqual(self.config.filters.get('startdate'), None)
self.assertEqual(self.config.filters.get('enddate'), None)

def test_report_config_for_type_domain_report_is_not_deleted_when_access_dispatcher(self):
# The dispatcher property surprisingly deletes the report config when the report type
# doesn't match any of the list of dispatcher's prefix
config = ReportConfig(report_type='domain_report')
config.save()
self.addCleanup(config.delete)
config._dispatcher
self.assertEqual(config.doc_type, 'ReportConfig')


class TestReportNotification(TestCase):
def test_unauthorized_user_cannot_view_report(self):
Expand Down

0 comments on commit b83e31d

Please sign in to comment.