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

(refactor) O3-3806: Refactor Service queue entries api call using OpenMrs Fetch All #1383

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

kb019
Copy link
Contributor

@kb019 kb019 commented Nov 21, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

To use hooks already present in esm-core to fetch all the queue entries.

Related Issue

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

OpenMRS.-.Google.Chrome.2024-11-20.22-32-36.webm

@kb019 kb019 changed the title Fix/api queues (refactor) O3-3806: Refactor Service queue entries api call using OpenMrs Fetch All Nov 21, 2024
@@ -57,7 +57,7 @@ function ClinicMetrics() {
/>
<MetricsCard
label={t('patients', 'Patients')}
value={initialSelectedItem ? totalCount ?? '--' : serviceCount}
value={initialSelectedItem ? totalCount || '--' : serviceCount}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used or Operator here because useOpenMrsFetchAll returns NaN when there is no total count and nullish collasing operator doesn't recognize NaN as faulty value. So we see for a Brief moment NaN being displayed in the metrics card .
We can overcome this using OR operator.

Copy link
Contributor

Choose a reason for hiding this comment

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

hm... but if totalCount is 0, we will just get '--'. I think we'll have to manually check for NaN (or isLoading from useOpenMrsFetchAll)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, correct . I will make the corrections. Thanks.

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