69 |
69 |
|
70 |
70 |
community['managers'] = new Array<string>();
|
71 |
71 |
|
|
72 |
let k=0
|
72 |
73 |
for (let i = 0; i < man_length; i++) {
|
73 |
74 |
if (this.community.managers[i] != undefined && !this.community.managers[i].replace(/\s/g, '').length) {
|
74 |
75 |
console.log(this.community.managers[i]);
|
75 |
|
this.community.managers.splice(i,1);
|
76 |
76 |
} else if (this.community.managers[i] != null && this.community.managers[i] != undefined && this.community.managers[i] != '') {
|
77 |
|
community['managers'][i] = this.community.managers[i];
|
|
77 |
community['managers'][k] = this.community.managers[i];
|
|
78 |
k++;
|
78 |
79 |
console.log(this.community.managers[i]);
|
79 |
|
} else {
|
80 |
|
console.log(this.community.managers[i]);
|
81 |
|
this.community.managers.splice(i,1);
|
82 |
80 |
}
|
83 |
|
}
|
|
81 |
}
|
84 |
82 |
|
85 |
|
// remove it after testing
|
86 |
|
// for (let i = 0; i < man_length; i++) {
|
87 |
|
// if (this.community.managers[i] != undefined && !this.community.managers[i].replace(/\s/g, '').length) {
|
88 |
|
// console.log(this.community.managers[i]);
|
89 |
|
// this.community.managers.splice(i,1);
|
90 |
|
// } else {
|
91 |
|
// community['managers'][i] = this.community.managers[i];
|
92 |
|
// console.log(this.community.managers[i]);
|
93 |
|
// }
|
94 |
|
// }
|
|
83 |
this.community.managers = community['managers'];
|
95 |
84 |
|
96 |
|
let sub_length = Array.isArray(this.community.subjects) ? this.community.subjects.length :1;
|
|
85 |
let sub_length = Array.isArray(this.community.subjects) ? this.community.subjects.length :1;
|
97 |
86 |
|
98 |
|
console.log(this.community.subjects);
|
|
87 |
console.log(this.community.subjects);
|
99 |
88 |
|
100 |
|
community['subjects'] = new Array<string>();
|
|
89 |
community['subjects'] = new Array<string>();
|
101 |
90 |
|
102 |
|
for (let i = 0; i < sub_length; i++) {
|
103 |
|
if (this.community.subjects[i] != undefined && !this.community.subjects[i].replace(/\s/g, '').length) {
|
|
91 |
let j=0;
|
|
92 |
for (let i = 0; i < sub_length; i++) {
|
|
93 |
if (this.community.subjects[i] != undefined && this.community.subjects[i].replace(/\s/g, '').length == 0) {
|
104 |
94 |
console.log(this.community.subjects[i]);
|
105 |
|
this.community.subjects.splice(i,1);
|
106 |
|
} else if (this.community.subjects[i] != null && this.community.subjects[i] != undefined && this.community.subjects[i] != '') {
|
107 |
|
community['subjects'][i] = this.community.subjects[i];
|
|
95 |
} else if (this.community.subjects[i] != null && this.community.subjects[i] != undefined ) {
|
|
96 |
community['subjects'][j] = this.community.subjects[i];
|
|
97 |
j++;
|
108 |
98 |
console.log(this.community.subjects[i]);
|
109 |
|
} else {
|
110 |
|
console.log(this.community.subjects[i]);
|
111 |
|
this.community.subjects.splice(i,1);
|
112 |
|
}
|
113 |
|
}
|
|
99 |
}
|
|
100 |
}
|
114 |
101 |
|
115 |
|
// remove it after testing
|
116 |
|
// for (let i = 0; i < sub_length; i++) {
|
117 |
|
// if (this.community.subjects[i] != undefined && !this.community.subjects[i].replace(/\s/g, '').length) {
|
118 |
|
// console.log(this.community.subjects[i]);
|
119 |
|
// this.community.subjects.splice(i,1);
|
120 |
|
// } else {
|
121 |
|
// community['subjects'][i] = this.community.subjects[i];
|
122 |
|
// console.log(this.community.subjects[i]);
|
123 |
|
// }
|
124 |
|
// }
|
|
102 |
this.community.subjects = community['subjects'];
|
125 |
103 |
|
126 |
104 |
console.log(this.properties.communityAPI);
|
|
105 |
console.log(community);
|
127 |
106 |
this._communityService.updateCommunity(this.properties.communityAPI+this.communityId, community).subscribe();
|
128 |
|
this._router.navigate(['/community-edit-form'], { queryParams: { "communityId": this.communityId} });
|
|
107 |
this._router.navigate(['/community-edit-form'], {queryParams: { "communityId": this.communityId}});
|
129 |
108 |
}
|
130 |
109 |
}
|
131 |
110 |
|
Fix error in managers and subjects fields