Skip to content

Commit

Permalink
Do not warn about discoverable system properties
Browse files Browse the repository at this point in the history
  • Loading branch information
millerdev committed Aug 29, 2024
1 parent 6145e2f commit 9dc3ca7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
5 changes: 3 additions & 2 deletions corehq/apps/case_importer/suggested_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,6 @@ def get_special_fields(domain=None):
return special_fields


def get_system_fields():
return [x.label for x in MAIN_CASE_TABLE_PROPERTIES]
def get_non_discoverable_system_properties():
discoverable = {s.field for s in get_special_fields() if s.description and s.discoverable}
return [p.label for p in MAIN_CASE_TABLE_PROPERTIES if p.label not in discoverable]
24 changes: 24 additions & 0 deletions corehq/apps/case_importer/tests/test_suggested_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from corehq.apps.case_importer.suggested_fields import (
FieldSpec,
get_suggested_case_fields,
get_non_discoverable_system_properties,
)
from corehq.util.test_utils import DocTestMixin

Expand Down Expand Up @@ -68,3 +69,26 @@ def test_basic_inclusion_and_sorting(self):
FieldSpec(field='weight', show_in_menu=True),
]
)


class TestSystemProperties(SimpleTestCase):

def test_get_non_discoverable_system_properties(self):
self.assertEqual(get_non_discoverable_system_properties(), [
'number',
'caseid',
'case_type',
'closed',
'closed_by_user_id',
'closed_by_username',
'closed_date',
'last_modified_by_user_id',
'last_modified_by_user_username',
'last_modified_date',
'opened_by_user_id',
'opened_by_username',
'opened_date',
'server_last_modified_date',
'state',
'case_link',
])
4 changes: 2 additions & 2 deletions corehq/apps/case_importer/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)
from corehq.apps.case_importer.suggested_fields import (
get_suggested_case_fields,
get_system_fields,
get_non_discoverable_system_properties,
)
from corehq.apps.case_importer.tracking.case_upload_tracker import CaseUpload
from corehq.apps.case_importer.util import (
Expand Down Expand Up @@ -373,7 +373,7 @@ def excel_fields(request, domain):
'columns': columns,
'excel_fields': excel_fields,
'case_field_specs': case_field_specs,
'system_fields': get_system_fields(),
'system_fields': get_non_discoverable_system_properties(),
'domain': domain,
'mirroring_enabled': mirroring_enabled,
'is_bulk_import': request.POST.get('is_bulk_import', 'False') == 'True',
Expand Down

0 comments on commit 9dc3ca7

Please sign in to comment.