Parse new field status in communities | add new field in communityInfo class

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51912 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-05-03 11:27:42 +00:00
parent a1c223bd78
commit 0ea6e5f774
3 changed files with 36 additions and 4 deletions

View File

@ -26,7 +26,9 @@ export class CommunitiesService {
let resData = Array.isArray(data) ? data[i] : data;
var result: CommunityInfo = new CommunityInfo();
//TODO @Sofia remove this if/else
// if there is case to be array do with resData what you do with data ( let resData = Array.isArray(data) ? data[i] : data;)
//don;t repeat the same code
if(Array.isArray(resData)) {
result['title'] = resData[0].name;
result['shortTitle'] = resData[0].shortName;
@ -35,6 +37,14 @@ export class CommunitiesService {
result['logoUrl'] = resData[0].logoUrl;
result['description'] = resData[0].description;
result['date'] = resData[0].creationDate;
result['status'] = "all";
if(resData[0].hasOwnProperty('status')){
result['status'] = resData[0].status;
var status = ["all","hidden","manager"];
if(status.indexOf(result['status']) ==-1){
result['status'] = "hidden";
}
}
if (resData[0].type != null) {
result['type'] = resData[0].type;
@ -76,7 +86,14 @@ export class CommunitiesService {
result['logoUrl'] = resData.logoUrl;
result['description'] = resData.description;
result['date'] = resData.creationDate;
result['status'] = "all";
if(resData.hasOwnProperty('status')){
result['status'] = resData.status;
var status = ["all","hidden","manager"];
if(status.indexOf(result['status']) ==-1){
result['status'] = "hidden";
}
}
if (resData.type != null) {
result['type'] = resData.type;
}

View File

@ -74,7 +74,14 @@ export class CommunityService {
community['logoUrl'] = resData[0].logoUrl;
community['description'] = resData[0].description;
community['date'] = resData[0].creationDate;
community['status'] = "all";
if(resData[0].hasOwnProperty('status')){
community['status'] = resData[0].status;
var status = ["all","hidden","manager"];
if(status.indexOf(community['status']) ==-1){
community['status'] = "hidden";
}
}
if (resData[0].type != null) {
community['type'] = resData[0].type;
}
@ -116,7 +123,14 @@ export class CommunityService {
community['logoUrl'] = resData.logoUrl;
community['description'] = resData.description;
community['date'] = resData.creationDate;
community['status'] = "all";
if(resData.hasOwnProperty('status')){
community['status'] = resData.status;
var status = ["all","hidden","manager"];
if(status.indexOf(community['status']) ==-1){
community['status'] = "hidden";
}
}
if (resData.type != null) {
community['type'] = resData.type;
}

View File

@ -9,4 +9,5 @@ export class CommunityInfo {
managers: string[];
date:Date;
subjects: string[];
status:string;
}