Skip to content

Commit

Permalink
Correct vocabulary for person counts is used (#2860)
Browse files Browse the repository at this point in the history
Fixes #2859.

(cherry picked from commit 1fa691d)
  • Loading branch information
ssuvorov-fls committed May 25, 2023
1 parent 3596dd0 commit e1f4499
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion js/pages/vocabulary/components/search.html
Expand Up @@ -79,7 +79,7 @@
options: resultSources,
optionsText: 'sourceName',
optionsValue: 'sourceKey',
value: currentResultSource,
value: currentResultSourceKey,
event: { change: refreshRecordCounts }
"></select>
</div>
Expand Down
12 changes: 6 additions & 6 deletions js/pages/vocabulary/components/search.js
Expand Up @@ -263,14 +263,14 @@ define([
});
}

this.currentResultSource = ko.observable();
this.currentResultSourceKey = ko.observable();
this.resultSources = ko.computed(() => {
const resultSources = [];
sharedState.sources().forEach((source) => {
if (source.hasResults && authApi.isPermittedAccessSource(source.sourceKey)) {
resultSources.push(source);
if (source.resultsUrl === sharedState.resultsUrl()) {
this.currentResultSource(source);
this.currentResultSourceKey(source.sourceKey);
}
}
})
Expand Down Expand Up @@ -432,7 +432,7 @@ define([
this.searchExecuted(true); // signals 'no results found' message
return;
}
await vocabularyProvider.loadDensity(recommendedConcepts, this.currentResultSource().sourceKey,(v)=>parseInt(v,10)); // formatting values as ints
await vocabularyProvider.loadDensity(recommendedConcepts, this.currentResultSourceKey(),(v)=>parseInt(v,10)); // formatting values as ints
recommendedConcepts.sort((a,b) => b.DESCENDANT_RECORD_COUNT - a.DESCENDANT_RECORD_COUNT); // sort descending order by DRC
const conceptSetStore = ConceptSetStore.repository();
const items = commonUtils.buildConceptSetItems([recommendedConcepts[0]], {includeDescendants: true});
Expand Down Expand Up @@ -468,7 +468,7 @@ define([
throw { message: 'No results found', results };
}

const promise = vocabularyProvider.loadDensity(results, this.currentResultSource().sourceKey);
const promise = vocabularyProvider.loadDensity(results, this.currentResultSourceKey());
promise.then(() => {
this.data(this.normalizeSearchResults(results));
});
Expand Down Expand Up @@ -514,12 +514,12 @@ define([
return;
}

this.currentResultSource(this.resultSources().find(source => source.sourceKey == event.target.value));
this.currentResultSourceKey(event.target.value);

this.recordCountsRefreshing(true);
this.columnHeadersWithIcons.forEach(c => this.toggleCountColumnHeaderSpin(c, true));
const results = this.data();
await vocabularyProvider.loadDensity(results, this.currentResultSource().sourceKey);
await vocabularyProvider.loadDensity(results, this.currentResultSourceKey());
this.data(results);
this.columnHeadersWithIcons.forEach(c => this.toggleCountColumnHeaderSpin(c, false));
this.recordCountsRefreshing(false);
Expand Down

0 comments on commit e1f4499

Please sign in to comment.