Skip to content

O3-5760: Return null rather than NaN for the average wait time - #120

Merged
NethmiRodrigo merged 2 commits into
openmrs:mainfrom
UjjawalPrabhat:O3-5760-average-wait-time-nan
Jul 31, 2026
Merged

NethmiRodrigo merged 2 commits into
openmrs:mainfrom
UjjawalPrabhat:O3-5760-average-wait-time-nan

Conversation

@UjjawalPrabhat

@UjjawalPrabhat UjjawalPrabhat commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Came up while reviewing openmrs-esm-patient-management#2615, where the Service Queues dashboard rendered "NaN mins".

QueueUtils.computeAverageWaitTimeInMinutes only guards against an empty entry list, but it averages over entries that have both a startedAt and an endedAt. A non-empty list where nothing has ended leaves the denominator at zero, so queue-entry-metrics?metric=averageWaitTime returns {"averageWaitTime":"NaN"}.

Returns null instead when there is no completed wait to average.

Related Issue

O3-5760

Other

Related PR here.

@NethmiRodrigo NethmiRodrigo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @UjjawalPrabhat! Just one minor thing

@sonarqubecloud

Copy link
Copy Markdown

@NethmiRodrigo NethmiRodrigo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @UjjawalPrabhat!

@NethmiRodrigo
NethmiRodrigo merged commit 04895c3 into openmrs:main Jul 31, 2026
9 checks passed
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