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

6895 don't round displayed prescribed quantity #6909

Merged
merged 2 commits into from
Mar 12, 2025

Conversation

fergie-nz
Copy link
Contributor

@fergie-nz fergie-nz commented Mar 12, 2025

Fixes #6895

πŸ‘©πŸ»β€πŸ’» What does this PR do?

Removes rounding to no decimals from prescription prescribed quantity display.

πŸ’Œ Any notes for the reviewer?

You can more easily view changes without new linting changes here

Values passed around retain all information; they were just getting rounded before front end display.

πŸ§ͺ Testing

  • Navigate to prescriptions
  • Add 2 or more items to the prescription
  • Set the quantity to a decimal for one of the items and save
  • See that this decimal value is retained when navigating between items

πŸ“ƒ Documentation

  • No documentation required: no user facing changes or a bug fix which isn't a change in behaviour

πŸ“ƒ Reviewer Checklist

The PR Reviewer(s) should fill out this section before approving the PR

Breaking Changes

  • No Breaking Changes in the Graphql API
  • Technically some Breaking Changes but not expected to impact any integrations

Issue Review

  • All requirements in original issue have been covered
  • A follow up issue(s) have been created to cover additional requirements

Tests Pass

  • Postgres
  • SQLite
  • Frontend

@fergie-nz fergie-nz linked an issue Mar 12, 2025 that may be closed by this pull request
@github-actions github-actions bot added this to the 2.6.1-RC2 milestone Mar 12, 2025
@github-actions github-actions bot added Team Piwakawaka James, Carl, John, Zachariah, Ferg Severity: Normal Bugs which have an acceptable workaround. Moderate/tolerable user impact. Next minor release. feature: dispensing labels Mar 12, 2025
Copy link

Bundle size difference

Comparing this PR to main

Old size New size Diff
5.98 MB 5.98 MB 10 B (0.00%)

@@ -559,7 +557,7 @@ const summarise = (
} else {
counts[packSize] = {
unitName: (stockLine?.item as ItemNode)?.unitName ?? 'unit',
count: NumUtils.round(packSize * numberOfPacks),
count: NumUtils.round(packSize * numberOfPacks, 2),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still rounding to 2 to avoid unwieldy numbers

setAbbreviation('');
setDefaultDirection('');
}, [item?.id]);
const newIssueQuantity = NumUtils.round(allocatedUnits / Math.abs(Number(packSizeController.selected?.value || 1)), 2);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rounding to 2dp here also to be consistent with other parts of app for input values.

@CarlosNZ CarlosNZ self-assigned this Mar 12, 2025
Copy link
Contributor

@CarlosNZ CarlosNZ left a comment

Choose a reason for hiding this comment

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

Nice, thanks @fergie-nz ! πŸ‘

@fergie-nz fergie-nz merged commit 167bd1f into v2.6.0-RC Mar 12, 2025
6 checks passed
@fergie-nz fergie-nz deleted the 6895-don't-round-displayed-prescribed-quantity branch March 12, 2025 02:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: dispensing Severity: Normal Bugs which have an acceptable workaround. Moderate/tolerable user impact. Next minor release. Team Piwakawaka James, Carl, John, Zachariah, Ferg
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Decimal packs in prescriptions don't always show
2 participants