Skip to content

Commit 37f9b56

Browse files
authored
(fix) Add cohort visits object (#1878)
1 parent 6ca3d87 commit 37f9b56

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/app/group-manager/group-detail/group-detail.component.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,13 @@ export class GroupDetailComponent implements OnInit, OnDestroy, AfterViewInit {
187187
res.cohortMembers,
188188
(member) => !member.endDate
189189
);
190-
this.cohortVisits = res.cohortVisits.sort((a: any, b: any) => {
191-
return Math.abs(
192-
new Date(b.startDate).getTime() - new Date(a.startDate).getTime()
193-
);
194-
});
190+
if (res.cohortVisits) {
191+
this.cohortVisits = res.cohortVisits.sort((a: any, b: any) => {
192+
return Math.abs(
193+
new Date(b.startDate).getTime() - new Date(a.startDate).getTime()
194+
);
195+
});
196+
}
195197
this.groupVisitDate = {
196198
date: this.today,
197199
jsdate: new Date()

src/app/openmrs-api/community-group-resource.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export class CommunityGroupService {
9595
let group: any;
9696
const params = new HttpParams().set(
9797
'v',
98-
'custom:(attributes,auditInfo,cohortLeaders,cohortType,description,display,endDate,groupCohort,location,name,startDate,uuid,voided,voidReason)'
98+
'custom:(attributes,auditInfo,cohortLeaders,cohortType,cohortVisits,description,display,endDate,groupCohort,location,name,startDate,uuid,voided,voidReason)'
9999
);
100100
const url = this.getOpenMrsBaseUrl() + '/cohort' + `/${groupUuid}`;
101101
return this.http

0 commit comments

Comments
 (0)