From 7205f2e34c625a27372d93b4338c4390301a348f Mon Sep 17 00:00:00 2001 From: "konstantina.galouni" Date: Mon, 25 Feb 2019 15:14:17 +0000 Subject: [PATCH] [Trunk|Library]: 1. env-properties: Add 'openCitationsAPIURL' property. 2. publication.service: Do not use cache for opencitations request. git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@54898 d315682c-612b-4755-9ff5-7f18f6832af3 --- .../publication/publication.service.ts | 49 ++++++++++--------- utils/properties/env-properties.ts | 2 +- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/landingPages/publication/publication.service.ts b/landingPages/publication/publication.service.ts index 1461d6e6..2e975d91 100644 --- a/landingPages/publication/publication.service.ts +++ b/landingPages/publication/publication.service.ts @@ -356,10 +356,11 @@ export class PublicationService { getOpenCitations(id: string, properties:EnvProperties) { //https://services.openaire.eu/opencitations/getCitations?id=doajarticles::2634200c24772ee8f10232d3e184ec65 - let url = /*properties.searchAPIURLLAst*/ "https://services.openaire.eu/opencitations/getCitations?id=" + id; + let url = properties.openCitationsAPIURL+id;// "https://services.openaire.eu/opencitations/getCitations?id=" + id; let key = url; - return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) + //return this.http.get((properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): url) + return this.http.get(url) .map(res => res.json()) .map(res => [res['total'], this.parseOpenCitations(res['results'])]); } @@ -376,31 +377,33 @@ export class PublicationService { let citation: {"url": string, "title": string, "year": string, "doi": string, "authors": string[]} = {"url": "", "title": "", "year": "", "doi": "", "authors": []}; - citation.url = openCitation.id; - citation.title = openCitation.title; - //citation.type = openCitation.type; - citation.year = (openCitation.pubDate && (openCitation.pubDate).indexOf('-') !== -1)?openCitation.pubDate.split('-')[0]:openCitation.pubDate; - citation.doi = openCitation.doi; + if(openCitation) { + citation.url = openCitation.id; + citation.title = openCitation.title; + //citation.type = openCitation.type; + citation.year = (openCitation.pubDate && (openCitation.pubDate).indexOf('-') !== -1)?openCitation.pubDate.split('-')[0]:openCitation.pubDate; + citation.doi = openCitation.doi; - let authorsLength = Array.isArray(openCitation.authors) ? openCitation.authors.length : 1; - for(let i=0; i