[Trunk|Library]: Bug fix in previous commit (Dataprovider Landing page - service: handle case of multiple values in originalId field)

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@55140 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-04-01 13:52:38 +00:00
parent 30dacd67a7
commit c88685cdaf
1 changed files with 8 additions and 4 deletions

View File

@ -73,20 +73,24 @@ export class DataProviderService {
var pattern = /.{12}::.+/;
var originalIds =(data[0].originalId)?data[0].originalId:"";
let length = originalIds.length!=undefined ? originalIds.length : 1;
let length = Array.isArray(originalIds) ? originalIds.length : 1;
console.info("originalIds: "+originalIds);
for(let i=0; i<length; i++) {
var originalId = originalIds.length!=undefined ? originalIds[i] : originalIds;
var originalId = Array.isArray(originalIds) ? originalIds[i] : originalIds;
console.info("originalId: "+originalId);
var matched = originalId.match(pattern);
//var result = str.substring(14);
if(matched && originalId && originalId != ""){
if(originalId.indexOf("opendoar____::") != -1){
this.dataProviderInfo.openDoarId = originalId.split("opendoar____::")[1];
console.info("openDoarId: "+this.dataProviderInfo.openDoarId);
}else if (originalId.indexOf("re3data_____::") != -1){
this.dataProviderInfo.r3DataId = originalId.split("re3data_____::")[1];
console.info("r3DataId: "+this.dataProviderInfo.r3DataId);
}
this.dataProviderInfo.originalId = originalId;
console.info("this.dataProviderInfo.originalId: "+this.dataProviderInfo.originalId);
}
}
}