Fix a bug in filters numbers
This commit is contained in:
parent
93598f3707
commit
7a6221e568
|
@ -1 +1 @@
|
|||
Subproject commit 045665ae107501603df4ad02ed95c9842c9c8a3e
|
||||
Subproject commit 104c54a3e861d65817aac59c56640457664eeaab
|
|
@ -1,19 +1,19 @@
|
|||
import { Component, ViewChild } from "@angular/core";
|
||||
import { SearchUtilsClass } from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||
import { ErrorMessagesComponent } from "../openaireLibrary/utils/errorMessages.component";
|
||||
import { ErrorCodes } from "../openaireLibrary/utils/properties/errorCodes";
|
||||
import { EnvProperties } from "../openaireLibrary/utils/properties/env-properties";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { AdvancedField, Filter, Value } from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
|
||||
import { SearchFields } from "../openaireLibrary/utils/properties/searchFields";
|
||||
import { Session, User } from "../openaireLibrary/login/utils/helper.class";
|
||||
import { StringUtils } from "../openaireLibrary/utils/string-utils.class";
|
||||
import { UserManagementService } from "../openaireLibrary/services/user-management.service";
|
||||
import { StakeholderService } from "../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import { NewSearchPageComponent } from "../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
||||
import { StakeholderInfo } from "../openaireLibrary/monitor/entities/stakeholder";
|
||||
import { properties } from "../../environments/environment";
|
||||
import { Subscriber } from "rxjs";
|
||||
import {Component, ViewChild} from "@angular/core";
|
||||
import {SearchUtilsClass} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class";
|
||||
import {ErrorMessagesComponent} from "../openaireLibrary/utils/errorMessages.component";
|
||||
import {ErrorCodes} from "../openaireLibrary/utils/properties/errorCodes";
|
||||
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
|
||||
import {ActivatedRoute} from "@angular/router";
|
||||
import {AdvancedField, Filter, Value} from "../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
|
||||
import {SearchFields} from "../openaireLibrary/utils/properties/searchFields";
|
||||
import {Session, User} from "../openaireLibrary/login/utils/helper.class";
|
||||
import {StringUtils} from "../openaireLibrary/utils/string-utils.class";
|
||||
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
|
||||
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {NewSearchPageComponent} from "../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
||||
import {StakeholderInfo} from "../openaireLibrary/monitor/entities/stakeholder";
|
||||
import {properties} from "../../environments/environment";
|
||||
import {Subscriber} from "rxjs";
|
||||
|
||||
@Component({
|
||||
selector: 'search-stakeholders',
|
||||
|
@ -60,7 +60,7 @@ export class SearchStakeholdersComponent {
|
|||
public keyword = "";
|
||||
public searchLink;
|
||||
properties: EnvProperties = properties;
|
||||
@ViewChild(NewSearchPageComponent, { static: true }) searchPage: NewSearchPageComponent;
|
||||
@ViewChild(NewSearchPageComponent, {static: true}) searchPage: NewSearchPageComponent;
|
||||
private user: User;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
|
@ -217,20 +217,19 @@ export class SearchStakeholdersComponent {
|
|||
*/
|
||||
private checkFilters(params) {
|
||||
let typeResults: StakeholderInfo[] = this.applyFilter('type', params);
|
||||
let accessResults: StakeholderInfo[] = this.results;
|
||||
let accessResults: StakeholderInfo[] = this.applyFilter('access', params);
|
||||
let roleResults: StakeholderInfo[] = this.results;
|
||||
accessResults = this.applyFilter('access', params);
|
||||
roleResults = this.applyFilter('role', params);
|
||||
this.resetFilterNumbers('access');
|
||||
this.updateFilterNumbers(typeResults.filter(value => {
|
||||
return roleResults.includes(value);
|
||||
}), 'access');
|
||||
if (this.user) {
|
||||
roleResults = this.applyFilter('role', params);
|
||||
this.resetFilterNumbers('role');
|
||||
this.updateFilterNumbers(accessResults.filter(value => {
|
||||
return typeResults.includes(value);
|
||||
}), 'role');
|
||||
}
|
||||
this.resetFilterNumbers('access');
|
||||
this.updateFilterNumbers(typeResults.filter(value => {
|
||||
return roleResults.includes(value);
|
||||
}), 'access');
|
||||
this.resetFilterNumbers('type');
|
||||
this.updateFilterNumbers(accessResults.filter(value => {
|
||||
return roleResults.includes(value);
|
||||
|
@ -356,7 +355,7 @@ export class SearchStakeholdersComponent {
|
|||
this.filters[i].values[0].number++;
|
||||
} else if (results[k].visibility === 'RESTRICTED') {
|
||||
this.filters[i].values[1].number++;
|
||||
} else {
|
||||
} else if (this.user) {
|
||||
this.filters[i].values[2].number++;
|
||||
}
|
||||
} else if (this.filters[i].filterId == 'role') {
|
||||
|
@ -449,7 +448,7 @@ export class SearchStakeholdersComponent {
|
|||
for (let i = 0; i < filter_names.length; i++) {
|
||||
let values: Value[] = [];
|
||||
for (let j = 0; j < value_names[i].length; j++) {
|
||||
let value: Value = { name: value_names[i][j], id: value_original_ids[i][j], number: 0, selected: false };
|
||||
let value: Value = {name: value_names[i][j], id: value_original_ids[i][j], number: 0, selected: false};
|
||||
values.push(value);
|
||||
}
|
||||
let filter: Filter = {
|
||||
|
|
Loading…
Reference in New Issue