diff --git a/packages/openchs-android/integrationTest/ReportCardServiceIntegrationTest.js b/packages/openchs-android/integrationTest/ReportCardServiceIntegrationTest.js index 6656b78e0..25b08afed 100644 --- a/packages/openchs-android/integrationTest/ReportCardServiceIntegrationTest.js +++ b/packages/openchs-android/integrationTest/ReportCardServiceIntegrationTest.js @@ -179,15 +179,15 @@ class ReportCardServiceIntegrationTest extends BaseIntegrationTest { latestEntityApprovalStatus: programEnc2EAS }))); - const approvedCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.Approved})); - const pendingCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.PendingApproval})); - const scheduledVisitsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.ScheduledVisits})); - const overdueVisitsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.OverdueVisits})); - const recentVisitsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.RecentVisits})); - const recentRegistrationsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.RecentRegistrations})); - const recentEnrolmentsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.RecentEnrolments})); - const totalCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.Total})); - const dueChecklistCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.DueChecklist})); + const approvedCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.Approved})); + const pendingCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.PendingApproval})); + const scheduledVisitsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.ScheduledVisits})); + const overdueVisitsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.OverdueVisits})); + const recentVisitsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.RecentVisits})); + const recentRegistrationsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.RecentRegistrations})); + const recentEnrolmentsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.RecentEnrolments})); + const totalCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.Total})); + const dueChecklistCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.DueChecklist})); this.approvedCard = db.create(ReportCard, TestReportCardFactory.create({name: "approvedCard", standardReportCardType: approvedCardType})); this.pendingCard = db.create(ReportCard, TestReportCardFactory.create({name: "pendingCard", standardReportCardType: pendingCardType})); this.scheduledVisitsCard = db.create(ReportCard, TestReportCardFactory.create({ @@ -220,7 +220,7 @@ class ReportCardServiceIntegrationTest extends BaseIntegrationTest { getCountForCommentCardType() { let commentCard; this.executeInWrite((db) => { - const commentCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.Comments})); + const commentCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.Comments})); commentCard = db.create(ReportCard, TestReportCardFactory.create({name: "dueChecklistCard", standardReportCardType: commentCardType})); const commentThread = db.create(CommentThread, TestCommentThreadFactory.create({})); @@ -234,8 +234,8 @@ class ReportCardServiceIntegrationTest extends BaseIntegrationTest { getCountForTaskCardType() { let callTaskTypeCard, openSubjectTaskTypeCard; this.executeInWrite((db) => { - const callTaskCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.CallTasks})); - const openSubjectTaskCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.OpenSubjectTasks})); + const callTaskCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.CallTasks})); + const openSubjectTaskCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.types.OpenSubjectTasks})); callTaskTypeCard = db.create(ReportCard, TestReportCardFactory.create({name: "callTaskTypeCard", standardReportCardType: callTaskCardType})); openSubjectTaskTypeCard = db.create(ReportCard, TestReportCardFactory.create({name: "callTaskTypeCard", standardReportCardType: openSubjectTaskCardType})); const callTaskType = db.create(TaskType, TestTaskTypeFactory.create({type: TaskType.TaskTypeName.Call})); diff --git a/packages/openchs-android/package-lock.json b/packages/openchs-android/package-lock.json index 7e5ae8792..095654f11 100644 --- a/packages/openchs-android/package-lock.json +++ b/packages/openchs-android/package-lock.json @@ -36,7 +36,7 @@ "lodash": "4.17.21", "moment": "2.29.4", "native-base": "3.4.9", - "openchs-models": "1.32.7", + "openchs-models": "1.32.9", "prop-types": "15.8.1", "react": "18.2.0", "react-native": "0.72.8", @@ -16554,9 +16554,9 @@ } }, "node_modules/openchs-models": { - "version": "1.32.7", - "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.32.7.tgz", - "integrity": "sha512-2PlPSedVNYHEvN5eM1tidICTtoEIrxLWxJxikb33vEV9UGWQM1fIw+D+Q+JYHWRcpXZ2tzuGFcvZTVq4U/oIOw==", + "version": "1.32.9", + "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.32.9.tgz", + "integrity": "sha512-yED21I+bFtoT1glQN41P6SxWFq563WboTJK6cDygOVuLWaorh5GeK8CxLvOUdjhdzxQMkvYF4dkphY2qa9IW9A==", "dependencies": { "uuid": "^9.0.1" }, @@ -35354,9 +35354,9 @@ } }, "openchs-models": { - "version": "1.32.7", - "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.32.7.tgz", - "integrity": "sha512-2PlPSedVNYHEvN5eM1tidICTtoEIrxLWxJxikb33vEV9UGWQM1fIw+D+Q+JYHWRcpXZ2tzuGFcvZTVq4U/oIOw==", + "version": "1.32.9", + "resolved": "https://registry.npmjs.org/openchs-models/-/openchs-models-1.32.9.tgz", + "integrity": "sha512-yED21I+bFtoT1glQN41P6SxWFq563WboTJK6cDygOVuLWaorh5GeK8CxLvOUdjhdzxQMkvYF4dkphY2qa9IW9A==", "requires": { "uuid": "^9.0.1" } diff --git a/packages/openchs-android/package.json b/packages/openchs-android/package.json index 8789dda98..a8634d024 100644 --- a/packages/openchs-android/package.json +++ b/packages/openchs-android/package.json @@ -59,7 +59,7 @@ "lodash": "4.17.21", "moment": "2.29.4", "native-base": "3.4.9", - "openchs-models": "1.32.7", + "openchs-models": "1.32.9", "jshashes": "1.0.8", "prop-types": "15.8.1", "react": "18.2.0", diff --git a/packages/openchs-android/src/service/customDashboard/ReportCardService.js b/packages/openchs-android/src/service/customDashboard/ReportCardService.js index 8944f7eb0..498976a9a 100644 --- a/packages/openchs-android/src/service/customDashboard/ReportCardService.js +++ b/packages/openchs-android/src/service/customDashboard/ReportCardService.js @@ -86,24 +86,24 @@ class ReportCardService extends BaseService { getResultForDefaultCardsType(reportFilters, reportCard) { const individualService = this.getService(IndividualService); const typeToMethodMap = new Map([ - [StandardReportCardType.type.ScheduledVisits, individualService.allScheduledVisitsIn], - [StandardReportCardType.type.OverdueVisits, individualService.allOverdueVisitsIn], - [StandardReportCardType.type.DueChecklist, individualService.dueChecklists.individual] + [StandardReportCardType.types.ScheduledVisits, individualService.allScheduledVisitsIn], + [StandardReportCardType.types.OverdueVisits, individualService.allOverdueVisitsIn], + [StandardReportCardType.types.DueChecklist, individualService.dueChecklists.individual] ]); - const standardReportCardTypeName = reportCard.standardReportCardType.name; + const standardReportCardTypeName = reportCard.standardReportCardType.type; const resultFunc = typeToMethodMap.get(standardReportCardTypeName); const formMetaData = DashboardReportFilter.getFormMetaDataFilterValues(reportFilters); const date = DashboardReportFilter.getAsOnDate(reportFilters); let result; - if (standardReportCardTypeName === StandardReportCardType.type.Total) { + if (standardReportCardTypeName === StandardReportCardType.types.Total) { result = individualService.allInV2(date, reportFilters, getSubjectCriteria(reportCard, formMetaData)); - } else if (standardReportCardTypeName === StandardReportCardType.type.RecentEnrolments) { + } else if (standardReportCardTypeName === StandardReportCardType.types.RecentEnrolments) { result = individualService.recentlyEnrolled(date, reportFilters, getProgramEnrolmentCriteria(reportCard, formMetaData), reportCard.getStandardReportCardInputRecentDuration()); - } else if (standardReportCardTypeName === StandardReportCardType.type.RecentRegistrations) { + } else if (standardReportCardTypeName === StandardReportCardType.types.RecentRegistrations) { result = individualService.recentlyRegisteredV2(date, reportFilters, getSubjectCriteria(reportCard, formMetaData), reportCard.getStandardReportCardInputRecentDuration()); - } else if (standardReportCardTypeName === StandardReportCardType.type.RecentVisits) { + } else if (standardReportCardTypeName === StandardReportCardType.types.RecentVisits) { result = individualService.recentlyCompletedVisitsIn(date, reportFilters, getProgramEncounterCriteria(reportCard, formMetaData), getGeneralEncounterCriteria(reportCard, formMetaData), true, true, reportCard.getStandardReportCardInputRecentDuration()); } else {