Skip to content

Commit

Permalink
chore(release): activate excluded filter collections (#1504)
Browse files Browse the repository at this point in the history
  • Loading branch information
elmessary authored Jan 18, 2024
1 parent 72e8da3 commit a6afdc3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
20 changes: 5 additions & 15 deletions CodeListLibrary_project/clinicalcode/entity_utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand All @@ -680,49 +678,41 @@ 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
},

'enum_radio_badge': {
'data_type': 'int',
'input_type': 'radiobutton',
'output_type': 'radiobutton',
'use_permitted_values': True,
'apply_badge_style': True
},

'enum_dropdown_badge': {
'data_type': 'int',
'input_type': 'dropdown',
'output_type': 'dropdown',
'use_permitted_values': True,
'apply_badge_style': True
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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):
"""
Expand All @@ -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')
Expand Down
2 changes: 0 additions & 2 deletions CodeListLibrary_project/cll/static/scss/pages/home/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,6 @@
}

&__container {
@include flex-row();

margin: 0;
padding: 0;
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

"sections": [
{
"title": "Name & Author",
"title": "Name - Author",
"description": "",
"fields": ["name", "author"],
"hide_on_detail": true
Expand Down

0 comments on commit a6afdc3

Please sign in to comment.