Skip to content

Commit

Permalink
Merge pull request #286 from molgenis/fix/icd10-expander
Browse files Browse the repository at this point in the history
fix: icd10 expander is now being used again
  • Loading branch information
tommydeboer authored Dec 10, 2021
2 parents f1ed6b7 + c441573 commit a7b0914
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/store/helpers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')),
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/specs/store/helpers/helpers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down Expand Up @@ -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)
})
Expand All @@ -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)
})
Expand Down

0 comments on commit a7b0914

Please sign in to comment.