Skip to content

Commit

Permalink
refactor: naming
Browse files Browse the repository at this point in the history
  • Loading branch information
mkangia committed Dec 3, 2024
1 parent b2b87a3 commit cc37c7b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions corehq/apps/userreports/tests/test_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from corehq.apps.userreports.reports.view import ConfigurableReportView
from corehq.apps.userreports.util import get_indicator_adapter
from corehq.apps.userreports.views import (
_number_of_records_to_be_iterated_for_rebuild,
number_of_records_to_be_processed,
)
from corehq.apps.users.models import HQApiKey, HqPermissions, UserRole, WebUser
from corehq.form_processor.models import CommCareCase
Expand Down Expand Up @@ -500,7 +500,7 @@ def _send_data_source_rebuild_request(self):
return self.client.post(path)

def test_number_of_records_to_be_iterated_for_rebuild(self):
number_of_cases = _number_of_records_to_be_iterated_for_rebuild(self.data_source_config)
number_of_cases = number_of_records_to_be_processed(self.data_source_config)
self.assertEqual(number_of_cases, 3)

def test_feature_flag(self):
Expand Down
4 changes: 2 additions & 2 deletions corehq/apps/userreports/ui/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ def clean(self):
return cleaned_data

def _check_for_asynchronous(self, config):
from corehq.apps.userreports.views import _number_of_records_to_be_iterated_for_rebuild
from corehq.apps.userreports.views import number_of_records_to_be_processed

if not config.asynchronous and toggles.RESTRICT_DATA_SOURCE_REBUILD.enabled(self.domain):
number_of_records = _number_of_records_to_be_iterated_for_rebuild(
number_of_records = number_of_records_to_be_processed(
datasource_configuration=config
)
if number_of_records and number_of_records > DATA_SOURCE_REBUILD_RESTRICTED_AT:
Expand Down
4 changes: 2 additions & 2 deletions corehq/apps/userreports/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,7 @@ def rebuild_data_source(request, domain, config_id):
config, is_static = get_datasource_config_or_404(config_id, domain)

if not config.asynchronous and toggles.RESTRICT_DATA_SOURCE_REBUILD.enabled(domain):
number_of_records = _number_of_records_to_be_iterated_for_rebuild(datasource_configuration=config)
number_of_records = number_of_records_to_be_processed(datasource_configuration=config)
if number_of_records and number_of_records > DATA_SOURCE_REBUILD_RESTRICTED_AT:
messages.error(
request,
Expand All @@ -1352,7 +1352,7 @@ def rebuild_data_source(request, domain, config_id):
))


def _number_of_records_to_be_iterated_for_rebuild(datasource_configuration):
def number_of_records_to_be_processed(datasource_configuration):
if datasource_configuration.referenced_doc_type == 'CommCareCase':
es_query = CaseSearchES().domain(datasource_configuration.domain)
case_types = [
Expand Down

0 comments on commit cc37c7b

Please sign in to comment.