Skip to content

Commit

Permalink
avniproject/avni-webapp#1263 | Standardise naming of recent type cards
Browse files Browse the repository at this point in the history
  • Loading branch information
1t5j0y committed Jun 28, 2024
1 parent ad3bcab commit 8ad3226
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,9 @@ class ReportCardServiceIntegrationTest extends BaseIntegrationTest {
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 latestVisitsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.LatestVisits}));
const latestRegistrationsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.LatestRegistrations}));
const latestEnrolmentsCardType = db.create(StandardReportCardType, TestStandardReportCardTypeFactory.create({name: StandardReportCardType.type.LatestEnrolments}));
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}));
this.approvedCard = db.create(ReportCard, TestReportCardFactory.create({name: "approvedCard", standardReportCardType: approvedCardType}));
Expand All @@ -195,14 +195,14 @@ class ReportCardServiceIntegrationTest extends BaseIntegrationTest {
standardReportCardType: scheduledVisitsCardType
}));
this.overdueVisitsCard = db.create(ReportCard, TestReportCardFactory.create({name: "overdueVisitsCard", standardReportCardType: overdueVisitsCardType}));
this.latestVisitsCard = db.create(ReportCard, TestReportCardFactory.create({name: "latestVisitsCard", standardReportCardType: latestVisitsCardType}));
this.latestRegistrationsCard = db.create(ReportCard, TestReportCardFactory.create({
name: "latestRegistrationsCard",
standardReportCardType: latestRegistrationsCardType
this.recentVisitsCard = db.create(ReportCard, TestReportCardFactory.create({name: "recentVisitsCard", standardReportCardType: recentVisitsCardType}));
this.recentRegistrationsCard = db.create(ReportCard, TestReportCardFactory.create({
name: "recentRegistrationsCard",
standardReportCardType: recentRegistrationsCardType
}));
this.latestEnrolmentsCard = db.create(ReportCard, TestReportCardFactory.create({
name: "latestEnrolmentsCard",
standardReportCardType: latestEnrolmentsCardType
this.recentEnrolmentsCard = db.create(ReportCard, TestReportCardFactory.create({
name: "recentEnrolmentsCard",
standardReportCardType: recentEnrolmentsCardType
}));
this.totalCard = db.create(ReportCard, TestReportCardFactory.create({name: "totalCard", standardReportCardType: totalCardType}));
this.dueChecklistCard = db.create(ReportCard, TestReportCardFactory.create({name: "dueChecklistCard", standardReportCardType: dueChecklistCardType}));
Expand Down Expand Up @@ -287,25 +287,25 @@ class ReportCardServiceIntegrationTest extends BaseIntegrationTest {
assert.equal(1, getCount(this, this.overdueVisitsCard, [this.twoAddressSelected]));
}

getCountForDefaultCardsType_forLatestVisits() {
assert.equal(1, getCount(this, this.latestVisitsCard, []));
assert.equal(0, getCount(this, this.latestVisitsCard, [this.addressSelected]));
assert.equal(1, getCount(this, this.latestVisitsCard, [this.address2Selected]));
assert.equal(1, getCount(this, this.latestVisitsCard, [this.twoAddressSelected]));
getCountForDefaultCardsType_forRecentVisits() {
assert.equal(1, getCount(this, this.recentVisitsCard, []));
assert.equal(0, getCount(this, this.recentVisitsCard, [this.addressSelected]));
assert.equal(1, getCount(this, this.recentVisitsCard, [this.address2Selected]));
assert.equal(1, getCount(this, this.recentVisitsCard, [this.twoAddressSelected]));
}

getCountForDefaultCardsType_forLatestRegistrations() {
assert.equal(2, getCount(this, this.latestRegistrationsCard, []));
assert.equal(1, getCount(this, this.latestRegistrationsCard, [this.addressSelected]));
assert.equal(1, getCount(this, this.latestRegistrationsCard, [this.address2Selected]));
assert.equal(2, getCount(this, this.latestRegistrationsCard, [this.twoAddressSelected]));
getCountForDefaultCardsType_forRecentRegistrations() {
assert.equal(2, getCount(this, this.recentRegistrationsCard, []));
assert.equal(1, getCount(this, this.recentRegistrationsCard, [this.addressSelected]));
assert.equal(1, getCount(this, this.recentRegistrationsCard, [this.address2Selected]));
assert.equal(2, getCount(this, this.recentRegistrationsCard, [this.twoAddressSelected]));
}

getCountForDefaultCardsType_forLatestEnrolments() {
assert.equal(1, getCount(this, this.latestEnrolmentsCard, []));
assert.equal(1, getCount(this, this.latestEnrolmentsCard, [this.addressSelected]));
assert.equal(0, getCount(this, this.latestEnrolmentsCard, [this.address2Selected]));
assert.equal(1, getCount(this, this.latestEnrolmentsCard, [this.twoAddressSelected]));
getCountForDefaultCardsType_forRecentEnrolments() {
assert.equal(1, getCount(this, this.recentEnrolmentsCard, []));
assert.equal(1, getCount(this, this.recentEnrolmentsCard, [this.addressSelected]));
assert.equal(0, getCount(this, this.recentEnrolmentsCard, [this.address2Selected]));
assert.equal(1, getCount(this, this.recentEnrolmentsCard, [this.twoAddressSelected]));
}

getCountForDefaultCardsType_forTotal() {
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 @@ -58,7 +58,7 @@
"lodash": "4.17.21",
"moment": "2.29.4",
"native-base": "3.4.9",
"openchs-models": "1.31.84",
"openchs-models": "1.31.85",
"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 @@ -64,9 +64,9 @@ class ReportCardService extends BaseService {
const typeToMethodMap = new Map([
[StandardReportCardType.type.ScheduledVisits, individualService.allScheduledVisitsIn],
[StandardReportCardType.type.OverdueVisits, individualService.allOverdueVisitsIn],
[StandardReportCardType.type.LatestVisits, individualService.recentlyCompletedVisitsIn],
[StandardReportCardType.type.LatestRegistrations, individualService.recentlyRegistered],
[StandardReportCardType.type.LatestEnrolments, individualService.recentlyEnrolled],
[StandardReportCardType.type.RecentVisits, individualService.recentlyCompletedVisitsIn],
[StandardReportCardType.type.RecentRegistrations, individualService.recentlyRegistered],
[StandardReportCardType.type.RecentEnrolments, individualService.recentlyEnrolled],
[StandardReportCardType.type.Total, individualService.allIn],
[StandardReportCardType.type.DueChecklist, individualService.dueChecklists.individual]
]);
Expand Down

0 comments on commit 8ad3226

Please sign in to comment.