From c441573c786cf7a3b9ee77e98b5f7ae571d824a5 Mon Sep 17 00:00:00 2001 From: Jelmer Veen Date: Thu, 9 Dec 2021 15:39:14 +0100 Subject: [PATCH] fix: icd10 expander is now being used again --- src/store/helpers/index.js | 4 +++- tests/unit/specs/store/helpers/helpers.spec.js | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/store/helpers/index.js b/src/store/helpers/index.js index 7992a222..ae472881 100644 --- a/src/store/helpers/index.js +++ b/src/store/helpers/index.js @@ -19,7 +19,9 @@ export const createRSQLQuery = (state) => transformToRSQL({ createQuery(state.filters.selections.materials, 'materials', state.filters.satisfyAll.includes('materials')), createQuery(state.filters.selections.type, 'type', state.filters.satisfyAll.includes('type')), createQuery(state.filters.selections.dataType, 'data_categories', state.filters.satisfyAll.includes('dataType')), - diagnosisAvailableQuery(state.filters.selections.diagnosis_available, 'diagnosis_available.id', state.filters.satisfyAll.includes('diagnosis_available')), + // diagnosis_availabe uses a dynamic decorator to do automatic tree expansion. Therefor it MUST be on the column from collection itself. + // And NOT on the column from the EntityType (table) it references to + diagnosisAvailableQuery(state.filters.selections.diagnosis_available, 'diagnosis_available', state.filters.satisfyAll.includes('diagnosis_available')), createQuery(state.collectionIdsWithSelectedQuality, 'id', state.filters.satisfyAll.includes('collection_quality')), createInQuery('collaboration_commercial', state.filters.selections.commercial_use || []), createQuery(state.filters.selections.collection_network, 'network', state.filters.satisfyAll.includes('collection_network')), diff --git a/tests/unit/specs/store/helpers/helpers.spec.js b/tests/unit/specs/store/helpers/helpers.spec.js index 997813df..123a29c4 100644 --- a/tests/unit/specs/store/helpers/helpers.spec.js +++ b/tests/unit/specs/store/helpers/helpers.spec.js @@ -139,7 +139,7 @@ describe('store', () => { state.filters.selections.diagnosis_available = ['id:G71', 'id:ORPHA:10', 'id:ORPHA:100'] const actual = helpers.createRSQLQuery(state) - const expected = 'diagnosis_available.id=in=(id:G71,id:ORPHA:10,id:ORPHA:100)' + const expected = 'diagnosis_available=in=(id:G71,id:ORPHA:10,id:ORPHA:100)' expect(actual).toBe(expected) }) @@ -176,7 +176,7 @@ describe('store', () => { state.filters.selections.country = ['NL', 'BE'] const actual = helpers.createRSQLQuery(state) - const expected = 'country=in=(NL,BE);diagnosis_available.id==id:G71;diagnosis_available.id==id:ORPHA:10;diagnosis_available.id==id:ORPHA:100' + const expected = 'country=in=(NL,BE);diagnosis_available==id:G71;diagnosis_available==id:ORPHA:10;diagnosis_available==id:ORPHA:100' expect(actual).toBe(expected) }) @@ -188,7 +188,7 @@ describe('store', () => { state.filters.satisfyAll = ['diagnosis_available', 'collection_quality'] const actual = helpers.createRSQLQuery(state) - const expected = 'diagnosis_available.id==id:G71;diagnosis_available.id==id:ORPHA:10;diagnosis_available.id==id:ORPHA:100;id==collection1;id==collection2' + const expected = 'diagnosis_available==id:G71;diagnosis_available==id:ORPHA:10;diagnosis_available==id:ORPHA:100;id==collection1;id==collection2' expect(actual).toBe(expected) })