Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix app load after upgradation of avni-client from old versions to 10.0 #54

Closed
himeshr opened this issue Sep 10, 2024 · 1 comment
Closed
Assignees

Comments

@himeshr
Copy link
Contributor

himeshr commented Sep 10, 2024

Issue

We have introduces several new fields in openchs-models, which are used in new CustomDashboards and related entities, with assumption that they are optional or so and would have values setup correctly on first sync post update.

But, in-case the org has CustomDashboard set as Primary Dashboard and their app gets upgraded, then after that App load would break everytime, preventing user from completing first time sync and hence result in him being forced to perform fresh sync.

AC

Perform all new Realm Entities fields initialization appropriately, so that app load does not fail after app upgrade without performing any sync post update.

Tech details

Based o code diff of 9.3 branch with 10.0 in Models repo, we found following places where we need to handle initialization of new columns of Realm Entities as part of Schema Migration for new CustomDashboardReportCards (Version 197):

  • StandardReportCardType => type and description fields //(Write code to init in same manner as in server, as shown below)
UPDATE standard_report_card_type
SET  description = 'Recent registrations', last_modified_date_time = current_timestamp
WHERE name = 'Last 24 hours registrations';
UPDATE standard_report_card_type
SET description = 'Recent enrolments', last_modified_date_time = current_timestamp
WHERE name = 'Last 24 hours enrolments',;
UPDATE standard_report_card_type
SET description = 'Recent visits', last_modified_date_time = current_timestamp
WHERE name = 'Last 24 hours visits';

alter table standard_report_card_type add column type varchar(100) null;
update standard_report_card_type set type =  replace(initcap(description), ' ', '') where 1 = 1;
alter table standard_report_card_type alter column type set not null;
  • DashboardFilterConfig => SubjectType // Mystery
  • ReportCard =>
    • standardReportCardInputSubjectTypes: {type: "list", objectType: "SubjectType"}, //EmptyArray
    • standardReportCardInputPrograms: {type: "list", objectType: "Program"},//EmptyArray
    • standardReportCardInputEncounterTypes: {type: "list", objectType: "EncounterType"}, //EmptyArray
    • standardReportCardInputRecentDurationJSON: {type: "string", optional: true} // "{"value":"1","unit":"days"}"
@github-project-automation github-project-automation bot moved this to New Issues in Avni Product Sep 10, 2024
@himeshr himeshr moved this from New Issues to Ready in Avni Product Sep 10, 2024
@1t5j0y 1t5j0y self-assigned this Sep 11, 2024
1t5j0y added a commit to avniproject/avni-client that referenced this issue Sep 11, 2024
@himeshr himeshr moved this from Code Review Ready to In Code Review in Avni Product Sep 11, 2024
@himeshr himeshr moved this from In Code Review to QA Failed in Avni Product Sep 11, 2024
@himeshr himeshr moved this from QA Failed to QA Ready in Avni Product Sep 11, 2024
@himeshr himeshr moved this from QA Ready to In QA in Avni Product Sep 11, 2024
@himeshr
Copy link
Contributor Author

himeshr commented Sep 13, 2024

Was unable to find any issues with configuring

  • DashboardFilterConfig - SubjectType
  • ReportCard - standardReportCardInputSubjectTypes, standardReportCardInputPrograms or standardReportCardInputEncounterTypes or standardReportCardInputRecentDurationJSON

As seen in
https://prerelease.avniproject.org/#/appDesigner/dashboard/603/show

@himeshr himeshr closed this as completed Sep 13, 2024
@github-project-automation github-project-automation bot moved this from In QA to Done in Avni Product Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants