[angular-16-community-projects-availableSince | DONE | UPDATE] : for the community projects, check if there is the date added, and when db is loaded to set id to "-1"

This commit is contained in:
argirok 2023-10-26 16:33:44 +03:00
parent 295b56b0e1
commit 0c2c02b659
1 changed files with 11 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import {Subscriber} from "rxjs";
import {NewSearchPageComponent} from "../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
import {SearchResult} from "../../openaireLibrary/utils/entities/searchResult";
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
import {IndexInfoService} from "../../openaireLibrary/utils/indexInfo.service";
@Component({
selector: 'openaire-search-projects',
@ -72,13 +73,17 @@ export class OpenaireSearchProjectsComponent {
public loadPaging: boolean = true;
public oldTotalResults: number = 0;
keyword;
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchCommunityProjectsService, private _communityService: CommunityService) {
lastDBLoadDate = null;
constructor (private route: ActivatedRoute, private _searchProjectsService: SearchCommunityProjectsService, private _communityService: CommunityService, private indexInfoService: IndexInfoService) {
this.errorCodes = new ErrorCodes();
this.errorMessages = new ErrorMessagesComponent();
this.searchUtils.status = this.errorCodes.LOADING;
}
public ngOnInit() {
this.subscriptions.push(this.indexInfoService.getLastIndexDate(this.properties).subscribe(res => {
this.lastDBLoadDate = res;
}));
this.searchUtils.baseUrl = this.properties.searchLinkToProjects;
this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe(community =>{
if(community != null){
@ -179,7 +184,11 @@ export class OpenaireSearchProjectsComponent {
let results:SearchResult[]=[];
for(let result of data){
let sResult:SearchResult = new SearchResult();
if(!result["availableSince"] || !this.lastDBLoadDate || (result["availableSince"] && this.lastDBLoadDate && result["availableSince"] < this.lastDBLoadDate)){
sResult.id = result.openaireId;
}else{
sResult.id = "-1"; //not yet in the graph
}
sResult.title = {name:"", accessMode: null};
sResult.title.name = result.name?result.name:result.acronym;
sResult.acronym = result['acronym'];