Skip to content

(feat) O3-5552: validate transition time to prevent negative wait duration#106

Open
Brijesh-0106 wants to merge 2 commits intoopenmrs:mainfrom
Brijesh-0106:O3-5552
Open

(feat) O3-5552: validate transition time to prevent negative wait duration#106
Brijesh-0106 wants to merge 2 commits intoopenmrs:mainfrom
Brijesh-0106:O3-5552

Conversation

@Brijesh-0106
Copy link
Copy Markdown

Requirements

  • This PR has a title that briefly describes the work done including
    the ticket number (feat) O3-5552 with conventional commit label.
  • My work is based on the existing validation patterns used throughout
    the queue module — the error response structure mirrors other validation
    errors in QueueEntryTransitionRestController and uses the same
    APIException approach consistent with the rest of the codebase.
  • My work does not yet include tests. This is my first contribution
    to this module and I plan to add tests in a follow-up PR after
    receiving initial feedback on the implementation.

Summary

The queue-entry transition endpoint accepted future dates as valid transition dates, which caused incorrect queue state — a transition could be recorded as happening in the future, making queue metrics and wait times unreliable for clinical staff.
This PR adds a server-side validation check that rejects any transition request where the provided transitionDate is in the future.
Changes made:

Added a future date check in QueueEntryTransitionRestController.transitionQueueEntry() immediately after the transition date is resolved
If the provided date is after the current server time, an APIException is thrown with a descriptive message including the invalid date value
Validation runs before any queue state is modified, so no partial transitions can occur

Example error response:

json{
  "error": {
    "message": "Transition cannot be in the future"
  }
}

Jira: O3-5552

Screenshots

No change in UI

Related Issue

https://openmrs.atlassian.net/browse/O3-5552

@Brijesh-0106 Brijesh-0106 changed the title (feat) O3-5552: Service Queue Transition-selecting future time (or changing AM/PM) allows transition and shows incorrect “waited for” time (e.g., -11 hours) (feat) O3-5552: validate transition time to prevent negative wait duration Mar 29, 2026
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.

1 participant