fix issue with selected types filter

This commit is contained in:
argirok 2022-04-21 16:35:34 +03:00
parent 020a947687
commit fc2fbb5ba0
1 changed files with 17 additions and 15 deletions

View File

@ -1468,23 +1468,25 @@ export class NewSearchPageComponent {
}*/
if ((this.entityType == 'publication' || this.entityType == 'dataset' || this.entityType == 'software' || this.entityType == 'other' || this.entityType == "result")) {
this.resultTypes = {values:[],filterId:"type", countSelectedValues: 0, filterType: 'checkbox', originalFilterId: "", valueIsExact: true, title: "Type",filterOperator:"or"};
if (URLparams["type"]) {
let types = URLparams["type"];
types = Array.isArray(types) ? types.join(',').split(",") : types.split(",");
for (let type of types) {
if (["publications", "datasets", "software", "other"].indexOf(StringUtils.unquote(type)) != -1 && this.resultTypeOptions[StringUtils.unquote(type)]) {
this.resultTypes.values.push({
name: this.resultTypeOptions[StringUtils.unquote(type)].name,
id: StringUtils.unquote(type),
selected: true,
number: 0
});
this.resultTypes.countSelectedValues++;
}
for (let typeOption of Object.keys(this.resultTypeOptions)) {
let type = typeOption;
if ( URLparams["type"] && URLparams["type"].indexOf(type)==-1 || !URLparams["type"]) {
this.resultTypes.values.push({
name: this.resultTypeOptions[StringUtils.unquote(type)].name,
id: StringUtils.unquote(type),
selected: false,
number: 0
});
}else{
this.resultTypes.values.push({
name: this.resultTypeOptions[StringUtils.unquote(type)].name,
id: StringUtils.unquote(type),
selected: true,
number: 0
});
this.resultTypes.countSelectedValues++;
}
}
}
this.URLCreatedFilters = filters;