[WIP] upload dois: add query for Irish results, get max 80 dois per request, small fixes in initialize stats and filters when new file selected, fix closed access filter

This commit is contained in:
argirok 2023-11-28 11:05:33 +02:00
parent 3f880a2251
commit 8783220966
1 changed files with 17 additions and 5 deletions

View File

@ -16,6 +16,7 @@ import {Filter} from "../openaireLibrary/searchPages/searchUtils/searchHelperCla
export class UploadDoisComponent implements OnInit {
page: number = 1;
size: number = 100;
requestSize: number = 80;
properties: EnvProperties = properties;
public errorCodes: ErrorCodes = new ErrorCodes();
public warningMessage = "";
@ -95,6 +96,17 @@ export class UploadDoisComponent implements OnInit {
this.onlyDiamond =false;
this.keyword = "";
this.showFound = true;
this.stats = {
open: 0,
closed: 0,
embargo: 0,
restricted: 0,
green:0,
gold:0,
hybrid:0,
bronze:0,
diamond:0
}
if (this.filesToUpload.length == 0) {
this.errorMessage = "There is no selected file to upload.";
return;
@ -199,7 +211,7 @@ export class UploadDoisComponent implements OnInit {
let page = 1;
let timerSubscription = timer(0, 1000).pipe(
map(() => {
if ((page - 1) * this.size <= this.allIds.length) {
if ((page - 1) * this.requestSize <= this.allIds.length) {
this.fetchResultsByPage(page); // load data contains the http request
page += 1;
} else {
@ -216,12 +228,12 @@ export class UploadDoisComponent implements OnInit {
}
fetchResultsByPage(page) {
let dois = this.allIds.slice((page - 1) * this.size, page * this.size);
let dois = this.allIds.slice((page - 1) * this.requestSize, page * this.requestSize);
if (dois.length == 0) {
return;
}
this.subscriptions.push(this._searchResearchResultsService.fetchByDOIs(dois).subscribe(data => {
this.subscriptions.push(this._searchResearchResultsService.fetchByDOIs(dois, "&fq=country=IE").subscribe(data => {
for (let result of data[1]) {
let matchingDOI = this.findMatchingDoi(result.DOIs, dois);
this.foundIds.push(matchingDOI);
@ -236,7 +248,6 @@ export class UploadDoisComponent implements OnInit {
this.results.push(showRes)
this.addStatsPerResult(showRes)
console.log(showRes, this.stats)
this.initFilters();
}
if (data[0] < dois.length) {
for (let doi of dois) {
@ -246,6 +257,7 @@ export class UploadDoisComponent implements OnInit {
}
}
}
this.initFilters();
this.updateView();
}));
@ -408,7 +420,7 @@ export class UploadDoisComponent implements OnInit {
{name: "Open Access", id: "Open Access", selected:false, number:this.stats["open"]},
{name: "Embargo", id: "Embargo", selected:false, number:this.stats["embargo"]},
{name: "Restricted", id: "Restricted", selected:false, number:this.stats["restricted"]},
{name: "Closed", id: "Closed", selected:false, number:this.stats["closed"]}
{name: "Closed Access", id: "Closed Access", selected:false, number:this.stats["closed"]}
]};
this.accessRouteFilter = {
countSelectedValues: 0,