diff --git a/changelog.md b/changelog.md index ae532f9f2..9a9399d70 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,12 @@ ### 0.23.0 (Major Release) +### 0.22.1 (Minor Release) + +#### Exclude many to one relationships from the advanced search + +Many to one fields are no longer visible in the advanced search screen. + ### 0.22.0 (Major Release) @@ -13,11 +19,11 @@ A list of functions attached to the application object that enable the application to add, remove or alter files in an advanced search extract. - #### Include ID in the extract The model ID will no longer be excluded from its csv extract. If present, id will appear first, then patient id, then episode id. + ### 0.21.0 (Major Release) #### Celery upgrade and Django Celery library change. diff --git a/doc/mkdocs.yml b/doc/mkdocs.yml index b2dc29e5d..2958d93c5 100644 --- a/doc/mkdocs.yml +++ b/doc/mkdocs.yml @@ -121,7 +121,7 @@ dev_addr: 0.0.0.0:8965 include_next_prev: false extra: - version: v0.21.0 + version: v0.23.0 markdown_extensions: - fenced_code diff --git a/opal/core/search/static/js/search/controllers/extract.js b/opal/core/search/static/js/search/controllers/extract.js index 13a9462c7..0f4e6b11a 100644 --- a/opal/core/search/static/js/search/controllers/extract.js +++ b/opal/core/search/static/js/search/controllers/extract.js @@ -85,10 +85,8 @@ angular.module('opal.controllers').controller( return criteria; }; - $scope.searchableFields = function(columnName){ var column = $scope.findColumn(columnName); - // TODO - don't hard-code this if(column){ return _.map( _.reject( @@ -97,8 +95,9 @@ angular.module('opal.controllers').controller( if(_.contains(NOT_ADVANCED_SEARCHABLE, c.name)){ return true; } - return c.type == 'token' || c.type == 'list'; + return c.type == 'token' || c.type == 'list' || c.type == "many_to_o";; }), + function(c){ return c; } ).sort(); } @@ -144,6 +143,9 @@ angular.module('opal.controllers').controller( }; $scope.getChoices = function(column, field){ + if(!field){ + return [] + } var modelField = $scope.findField(column, field); if(modelField.lookup_list && modelField.lookup_list.length){ diff --git a/opal/core/search/static/js/test/extract.controller.test.js b/opal/core/search/static/js/test/extract.controller.test.js index 371138e7b..43b844268 100644 --- a/opal/core/search/static/js/test/extract.controller.test.js +++ b/opal/core/search/static/js/test/extract.controller.test.js @@ -102,6 +102,12 @@ describe('ExtractCtrl', function(){ "name":"consistency_token", "type":"token" }, + { + "title":"A Many To One", + "lookup_list":null, + "name":"a many to one", + "type":"many_to_o" + }, { "title":"Created", "lookup_list":null, @@ -375,6 +381,11 @@ describe('ExtractCtrl', function(){ var result = $scope.getChoices("some", "field"); expect(result).toEqual([1, 2, 3]); }); + + it('should error if there is no field', function(){ + var result = $scope.getChoices("some", null); + expect(result).toEqual([]); + }); }); describe('refresh', function(){