Skip to content

(fix) Default to using the current date#60

Merged
ibacher merged 1 commit into
openmrs:mainfrom
openmrs-sh:O3-2312
Aug 17, 2023
Merged

(fix) Default to using the current date#60
ibacher merged 1 commit into
openmrs:mainfrom
openmrs-sh:O3-2312

Conversation

@AlexanderMizgirev

Copy link
Copy Markdown
Contributor

Requirements

  • This PR has a title that briefly describes the work done, including the ticket number if there is a ticket.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This merge request is intended to resolve the issue with form saving. Currently, no form on the website can be saved because the encounterType is not being set in the request. While addressing this problem, I discovered that there is also an issue with encounterDatetime. This field is not being added as well, but these changes should rectify it.
Additionally, I found a problem where active visits, which are automatically created during application deployment, cannot work correctly with this date. When starting a visit manually, the date is set correctly, and everything starts working.

Screenshots

Related Issue

https://issues.openmrs.org/browse/O3-2312

Other

Should be merged with: openmrs/openmrs-esm-patient-chart#1314

payload,
form.valueProcessingInfo.encounterTypeUuid
);
this.setPayloadEncounterDateUuid(payload, form.valueProcessingInfo.encounterDatetime, form.valueProcessingInfo.utcOffset);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this.setPayloadEncounterDateUuid(payload, form.valueProcessingInfo.encounterDatetime, form.valueProcessingInfo.utcOffset);
this.setPayloadEncounterDate(payload, form.valueProcessingInfo.encounterDatetime, form.valueProcessingInfo.utcOffset);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied

payload,
form.valueProcessingInfo.encounterTypeUuid
);
this.setPayloadEncounterDateUuid(payload, form.valueProcessingInfo.encounterDatetime, form.valueProcessingInfo.utcOffset);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in it's own, separate guarded clause to ensure:

  1. That the payload encounterDatetime isn't already set (e.g., by an encounterDateTime node).
  2. That the form.valueProcessingInfo.encounterDatetime is populated with a value. Unless, are we relying on null returning today's date and time?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@ibacher

ibacher commented Aug 17, 2023

Copy link
Copy Markdown
Member

Hi @AlexanderMizgirev,

So I think the underlying issue here was caused by a fault in the o3forms backend module. We've published an updated version (2.1.0) that should fix the issue. Could you try that out and see if it resolves things?

@ibacher ibacher changed the title (fix) O3-2312: Cannot Save Diagnoses in Form - encounterType Missing (fix) Default to using the current date Aug 17, 2023
@ibacher ibacher merged commit bc089af into openmrs:main Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants