Production release February 2024 #30
|
@ -84,9 +84,11 @@ export class SearchFilterComponent implements OnInit, OnChanges {
|
|||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
if (changes.filter) {
|
||||
this.hasMoreValues = this.filter.values.length > this.filterValuesNum;
|
||||
this.hasMoreValues = (this.filter.countUnfilteredValues > 0 ? this.filter.countUnfilteredValues : this.filter.values.length) > this.filterValuesNum;
|
||||
// this.filter.values = this.filter.values.filter(value => !value.name.toLowerCase().includes('unknown') && !value.name.toLowerCase().includes('not available'));
|
||||
this.filter.values = this.filter.values.filter(value => value && value.name != "unidentified" && value.name != "Undetermined" && !value.name.toLowerCase().includes('unknown') && !value.name.toLowerCase().includes('not available'));
|
||||
// this.filter.values = this.filter.values.filter(value => value && value.name != "unidentified" && value.name != "Undetermined" && !value.name.toLowerCase().includes('unknown') && !value.name.toLowerCase().includes('not available')
|
||||
// && value.name.toLowerCase() != "null"
|
||||
// );
|
||||
|
||||
if (this.filter.filterType == "radio") {
|
||||
this.filter.radioValue = "";
|
||||
|
|
|
@ -13,6 +13,7 @@ export class Filter{
|
|||
// public uniqueValueIdSelected: string;
|
||||
public countAllValues?: number = -1; // -1: not yet requested, 0: request failed, >0 OK
|
||||
public isOpen?: boolean = false;
|
||||
public countUnfilteredValues?: number = 0;
|
||||
}
|
||||
|
||||
export class Value{
|
||||
|
|
|
@ -11,7 +11,7 @@ export class RefineResultsUtils {
|
|||
|
||||
var searchFields:SearchFields = new SearchFields();
|
||||
var filters:Filter[] = [];
|
||||
if(data && fields){
|
||||
if(data && Object.keys(data).length > 0 && fields){
|
||||
for(let j=0; j<fields.length; j++) {
|
||||
|
||||
var filter:Filter = new Filter();
|
||||
|
@ -27,15 +27,16 @@ export class RefineResultsUtils {
|
|||
|
||||
let field = data[fields[j]];
|
||||
if(field){
|
||||
filter.countUnfilteredValues = field.length;
|
||||
for(let i=0; i<field.length; i++) {
|
||||
var value:Value = new Value();
|
||||
value.name = field[i].name;
|
||||
value.name =this.removePartAfterCharacters(value,"||");
|
||||
value.number = field[i].count;
|
||||
value.id = field[i].id;
|
||||
//if(RefineResultsUtils.includeValue(value)){
|
||||
if(RefineResultsUtils.includeValue(value)){
|
||||
filter.values.push(value);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -51,11 +52,14 @@ export class RefineResultsUtils {
|
|||
return filters;
|
||||
}
|
||||
private static includeValue (field):boolean {
|
||||
if( !field || !field.name || field.name == "unidentified" || field.name == "Undetermined" ){
|
||||
return false;
|
||||
// if( !field || !field.name || field.name == "unidentified" || field.name == "Undetermined" ){
|
||||
if( field && field.name && field.name != "unidentified" && field.name != "Undetermined"
|
||||
&& !field.name.toLowerCase().includes('unknown') && !field.name.toLowerCase().includes('not available')
|
||||
&& field.name.toLowerCase() != "null") {
|
||||
return true;
|
||||
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
private static removePartAfterCharacters(field, characters):string {
|
||||
if( field.name.indexOf(characters) !=-1){
|
||||
|
|
Loading…
Reference in New Issue