From a6afdc31071380fa10463232851e3dc92ce0774a Mon Sep 17 00:00:00 2001 From: Muhammad A Elmessary <33552352+elmessary@users.noreply.github.com> Date: Thu, 18 Jan 2024 19:44:36 +0000 Subject: [PATCH] chore(release): activate excluded filter collections (#1504) --- .../clinicalcode/entity_utils/constants.py | 20 +++++-------------- .../templatetags/entity_renderer.py | 17 ++++++++++++++++ .../cll/static/scss/pages/home/base.scss | 2 -- .../clinical_coded_phenotype.json | 2 +- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/CodeListLibrary_project/clinicalcode/entity_utils/constants.py b/CodeListLibrary_project/clinicalcode/entity_utils/constants.py index 3e9f69aab..d149e0c27 100644 --- a/CodeListLibrary_project/clinicalcode/entity_utils/constants.py +++ b/CodeListLibrary_project/clinicalcode/entity_utils/constants.py @@ -660,14 +660,12 @@ class FORM_METHODS(int, enum.Enum, metaclass=IterableMeta): 'string_inputbox': { 'data_type': 'string', 'input_type': 'inputbox', - 'output_type': 'inputbox', - 'max_length': 250 + 'output_type': 'inputbox' }, 'string_inputbox_code': { 'data_type': 'string', 'input_type': 'inputbox', 'output_type': 'inputbox', - 'max_length': 250, 'apply_code_style': True }, 'textarea': { @@ -680,33 +678,27 @@ class FORM_METHODS(int, enum.Enum, metaclass=IterableMeta): 'data_type': 'string', 'input_type': 'markdown', 'output_type': 'markdown', - 'rows': 5, - 'display': 'markdown' + 'rows': 5 }, 'string_list_of_inputboxes': { - 'data_type': 'string', - 'max_length': 250 + 'data_type': 'string' }, 'string_list_of_inputboxes_markdown': { 'data_type': 'string', 'input_type': 'list_of_inputboxes', - 'output_type': 'list_of_inputboxes', - 'max_length': 250, - 'display': 'markdown' + 'output_type': 'list_of_inputboxes' }, 'enum': { 'data_type': 'int', 'input_type': 'dropdown-list', - 'output_type': 'dropdown-list', - 'use_permitted_values': True + 'output_type': 'dropdown-list' }, 'grouped_enum': { 'data_type': 'int', 'input_type': 'grouped_enum', 'output_type': 'radiobutton', - 'use_permitted_values': True, 'apply_badge_style': True }, @@ -714,7 +706,6 @@ class FORM_METHODS(int, enum.Enum, metaclass=IterableMeta): 'data_type': 'int', 'input_type': 'radiobutton', 'output_type': 'radiobutton', - 'use_permitted_values': True, 'apply_badge_style': True }, @@ -722,7 +713,6 @@ class FORM_METHODS(int, enum.Enum, metaclass=IterableMeta): 'data_type': 'int', 'input_type': 'dropdown', 'output_type': 'dropdown', - 'use_permitted_values': True, 'apply_badge_style': True }, diff --git a/CodeListLibrary_project/clinicalcode/templatetags/entity_renderer.py b/CodeListLibrary_project/clinicalcode/templatetags/entity_renderer.py index 8144d17e8..b711d11b9 100644 --- a/CodeListLibrary_project/clinicalcode/templatetags/entity_renderer.py +++ b/CodeListLibrary_project/clinicalcode/templatetags/entity_renderer.py @@ -10,6 +10,7 @@ from ..entity_utils import permission_utils, template_utils, search_utils, model_utils, create_utils, gen_utils, constants from ..models.GenericEntity import GenericEntity +from ..models.Brand import Brand register = template.Library() @@ -354,6 +355,21 @@ def __try_compile_reference(self, context, field, structure): modifier = None return search_utils.get_source_references(structure, default=[], modifier=modifier) + + def __check_excluded_brand_collections(self, context, field, current_brand, options): + """ + Checks and removes Collections excluded from filters + """ + updated_options = options + if field == 'collections': + if current_brand !='' and current_brand != 'ALL': + if Brand.objects.all().filter(name__iexact=current_brand).exists(): + brand = Brand.objects.get(name__iexact=current_brand) + collections_excluded_from_filters = brand.collections_excluded_from_filters + if collections_excluded_from_filters: + updated_options = [o for o in options if o['pk'] not in collections_excluded_from_filters] + + return updated_options def __render_metadata_component(self, context, field, structure): """ @@ -372,6 +388,7 @@ def __render_metadata_component(self, context, field, structure): if 'compute_statistics' in structure: current_brand = request.CURRENT_BRAND or 'ALL' options = search_utils.get_metadata_stats_by_field(field, brand=current_brand) + options = self.__check_excluded_brand_collections(context, field, current_brand, options) if options is None: validation = template_utils.try_get_content(structure, 'validation') diff --git a/CodeListLibrary_project/cll/static/scss/pages/home/base.scss b/CodeListLibrary_project/cll/static/scss/pages/home/base.scss index 3fce874b7..af3a54b98 100644 --- a/CodeListLibrary_project/cll/static/scss/pages/home/base.scss +++ b/CodeListLibrary_project/cll/static/scss/pages/home/base.scss @@ -520,8 +520,6 @@ } &__container { - @include flex-row(); - margin: 0; padding: 0; align-items: center; diff --git a/CodeListLibrary_project/dynamic_templates/clinical_coded_phenotype.json b/CodeListLibrary_project/dynamic_templates/clinical_coded_phenotype.json index 3c931c227..9478c527f 100644 --- a/CodeListLibrary_project/dynamic_templates/clinical_coded_phenotype.json +++ b/CodeListLibrary_project/dynamic_templates/clinical_coded_phenotype.json @@ -8,7 +8,7 @@ "sections": [ { - "title": "Name & Author", + "title": "Name - Author", "description": "", "fields": ["name", "author"], "hide_on_detail": true