Skip to content

Commit

Permalink
#54 | Migration to initialise StandardReportCardType.type values
Browse files Browse the repository at this point in the history
  • Loading branch information
1t5j0y committed Sep 11, 2024
1 parent f9ca47d commit 00130ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/Schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,20 @@ function createRealmConfig() {
if (oldDB.schemaVersion < 191) {
newDB.delete(newDB.objects("CustomDashboardCache"));
}
if (oldDB.schemaVersion < 197) {
_.forEach(newDB.objects("StandardReportCardType"), (standardReportCardType) => {
if (standardReportCardType.name === 'Last 24 hours registrations') {
standardReportCardType.description = 'Recent registrations';
}
if (standardReportCardType.name === 'Last 24 hours enrolments') {
standardReportCardType.description = 'Recent enrolments';
}
if (standardReportCardType.name === 'Last 24 hours visits') {
standardReportCardType.description = 'Recent visits';
}
standardReportCardType.type = _.replace(_.startCase(standardReportCardType.description), new RegExp(' ', 'g'), '');
});
}
},
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/StandardReportCardType.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class StandardReportCardType extends BaseEntity {
uuid: "string",
name: "string",
description: {type: "string", optional: true},
type: {type: "string", optional: true},
type: {type: "string"},
voided: {type: "bool", default: false},
},
};
Expand Down

0 comments on commit 00130ee

Please sign in to comment.