-
-
Notifications
You must be signed in to change notification settings - Fork 218
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
Add Enterprise Case Management Report #35482
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Two clarifying questions (for my own understanding)
def app_query(self, domain): | ||
return ( | ||
AppES().domain(domain) | ||
.filter(filters.term('doc_type', 'Application')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to make sure we don't get LinkedApplication
s or RemoteApp
s?
|
||
def get_report_task(self, request): | ||
account = BillingAccount.get_account_by_domain(request.domain) | ||
return generate_enterprise_report.s( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's .s()
do here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me except for a few nit.
|
||
@property | ||
def headers(self): | ||
return [_('Project Space'), _('# Applications'), _('# Surveys Only'), _('# Cases Only'), _('# Mixed')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# of
instead of #
for the last 4 columns?
has_surveys = filters.nested('modules', filters.empty('modules.case_type.exact')) | ||
has_cases = filters.nested('modules', filters.non_null('modules.case_type.exact')) | ||
|
||
survey_only_count = app_query.filter(filters.AND(has_surveys, filters.NOT(has_cases))).count() | ||
case_only_count = app_query.filter(filters.AND(has_cases, filters.NOT(has_surveys))).count() | ||
mixed_count = app_query.filter(filters.AND(has_surveys, has_cases)).count() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Elegant... nice naming and nice logic
|
||
case_management_percent = num_domains_using_case_management / num_domains_with_apps * 100 | ||
|
||
return "{:.1f}%".format(case_management_percent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made a util function for display percentage with only one digit in 1aec926. Can reuse it after my PR is merged.
|
||
REPORT_SLUG = EnterpriseReport.CASE_MANAGEMENT | ||
|
||
def get_report_task(self, request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function can be removed as I moved get_report_task
to base class in 5609175
return bundle | ||
|
||
def get_primary_keys(self): | ||
return ('domain',) # very odd report that makes coming up with an actual key challenging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think domain is a valid primary key in this case? Just don't get why it is challenging.
Product Description
Creates a new Enterprise Console Tile and API for the Case Management Report
Console:
Generated Report:
API:
Technical Summary
Associated ticket: https://dimagi.atlassian.net/browse/SAAS-16336. Also covers the Tile and API tickets.
Feature Flag
None
Safety Assurance
Safety story
Tested locally
Automated test coverage
Automated tests to be added later, once the logic is extracted from the report to a general location.
QA Plan
TBD
Rollback instructions
Labels & Review