diff --git a/src/shared/components/query/CancerStudySelector.tsx b/src/shared/components/query/CancerStudySelector.tsx index 8e2b562fb17..0ff76b86e9f 100644 --- a/src/shared/components/query/CancerStudySelector.tsx +++ b/src/shared/components/query/CancerStudySelector.tsx @@ -202,6 +202,10 @@ export default class CancerStudySelector extends React.Component< const quickSetButtons = this.logic.mainView.quickSelectButtons( getServerConfig().skin_quick_select_buttons ); + const shownStudiesLengthstring = + shownStudies.length < this.store.cancerStudies.result.length + ? 'matching filter' + : ''; return ( {shownAndSelectedStudies.length === shownStudies.length - ? `Deselect all listed studies ${ - shownStudies.length < - this.store - .cancerStudies - .result - .length - ? 'matching filter' - : '' - } (${ - shownStudies.length - })` - : `Select all listed studies ${ - shownStudies.length < - this.store - .cancerStudies - .result - .length - ? 'matching filter' - : '' - } (${ - shownStudies.length - })`} + ? `Deselect all listed studies ${shownStudiesLengthstring} (${shownStudies.length})` + : `Select all listed studies ${shownStudiesLengthstring} (${shownStudies.length})`} @@ -385,28 +369,8 @@ export default class CancerStudySelector extends React.Component< shownAndAuthorizedStudies.length && shownAndAuthorizedStudies.length > 0 - ? `Deselect all authorized studies ${ - shownStudies.length < - this.store - .cancerStudies - .result - .length - ? 'matching filter' - : '' - } (${ - shownAndAuthorizedStudies.length - })` - : `Select all authorized studies ${ - shownStudies.length < - this.store - .cancerStudies - .result - .length - ? 'matching filter' - : '' - } (${ - shownAndAuthorizedStudies.length - })`} + ? `Deselect all authorized studies ${shownStudiesLengthstring} (${shownAndAuthorizedStudies.length})` + : `Select all authorized studies ${shownStudiesLengthstring} (${shownAndAuthorizedStudies.length})`} diff --git a/src/shared/components/query/QueryStore.ts b/src/shared/components/query/QueryStore.ts index 574f8120c7c..25f831730fe 100644 --- a/src/shared/components/query/QueryStore.ts +++ b/src/shared/components/query/QueryStore.ts @@ -1236,7 +1236,12 @@ export class QueryStore { return client .getAllSamplesOfPatientInStudyUsingGET({ studyId, patientId }) .then( - samples => ({ studyId, patientId, samples, error: undefined }), + samples => ({ + studyId, + patientId, + samples, + error: undefined, + }), error => ({ studyId, patientId, @@ -1480,11 +1485,12 @@ export class QueryStore { } @computed get readPermissions(): Set { - const studies = Array.from(this.treeData.map_node_meta.keys()).filter( s => typeof((s as CancerStudy).readPermission) !== 'undefined' ); - console.log(studies); - const readPermissions = studies - .map(n => (!!((n as CancerStudy).readPermission)).toString()) - .filter(n => !!n); + const studies = Array.from(this.treeData.map_node_meta.keys()).filter( + s => typeof (s as CancerStudy).readPermission !== 'undefined' + ); + const readPermissions = studies.map(n => + (n as CancerStudy).readPermission.toString() + ); return new Set(readPermissions); } diff --git a/src/shared/components/query/filteredSearch/Phrase.tsx b/src/shared/components/query/filteredSearch/Phrase.tsx index 58b48c65d1e..010b4096cd9 100644 --- a/src/shared/components/query/filteredSearch/Phrase.tsx +++ b/src/shared/components/query/filteredSearch/Phrase.tsx @@ -129,11 +129,9 @@ export class ListPhrase implements Phrase { public match(study: FullTextSearchNode): boolean { let anyFieldMatch = false; for (const fieldName of this.fields) { - if (!_.has(study, fieldName)) { - continue; - } - const fieldValue = (study as any)[fieldName]; - if (typeof fieldValue !== 'undefined') { + let anyPhraseMatch = false; + const fieldValue = study[fieldName]; + if (fieldValue) { for (const phrase of this._phraseList) { anyPhraseMatch = anyPhraseMatch || diff --git a/src/shared/lib/query/QueryParser.spec.ts b/src/shared/lib/query/QueryParser.spec.ts index 1192dac26a1..2e84ec80562 100644 --- a/src/shared/lib/query/QueryParser.spec.ts +++ b/src/shared/lib/query/QueryParser.spec.ts @@ -11,7 +11,7 @@ import { QueryParser } from 'shared/lib/query/QueryParser'; import { StringPhrase } from 'shared/components/query/filteredSearch/Phrase'; describe('QueryParser', () => { - const parser = new QueryParser(new Set(),new Set()); + const parser = new QueryParser(new Set(), new Set()); const referenceGenomeFields = parser.searchFilters.find( f => f.phrasePrefix === 'reference-genome' )!.nodeFields; diff --git a/src/shared/lib/query/QueryParser.ts b/src/shared/lib/query/QueryParser.ts index f95fe8fc8d6..d9a317522be 100644 --- a/src/shared/lib/query/QueryParser.ts +++ b/src/shared/lib/query/QueryParser.ts @@ -27,9 +27,6 @@ export class QueryParser { private readonly _searchFilters: CancerTreeSearchFilter[]; constructor(referenceGenomes: Set, readPermissions: Set) { - console.log('readPermissions'); - console.log(readPermissions); - console.log(readPermissions.size); this._searchFilters = [ /** * Example queries: @@ -65,10 +62,16 @@ export class QueryParser { nodeFields: ['readPermission'], form: { input: FilterCheckbox, - options: readPermissions.size > 1 ? [ - { value: 'true', displayValue: 'Authorized' }, - { value: 'false', displayValue: 'Unauthorized' }, - ]:[], + options: + readPermissions.size > 1 + ? [ + { value: 'true', displayValue: 'Authorized' }, + { + value: 'false', + displayValue: 'Unauthorized', + }, + ] + : [], label: 'Controlled access', }, },