Skip to content

Commit

Permalink
avniproject/avni-server#781 | StandardReportCardType type to types
Browse files Browse the repository at this point in the history
  • Loading branch information
1t5j0y committed Sep 5, 2024
1 parent cb44672 commit b6abba7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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({}));
Expand All @@ -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}));
Expand Down
14 changes: 7 additions & 7 deletions packages/openchs-android/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/openchs-android/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b6abba7

Please sign in to comment.