-
Notifications
You must be signed in to change notification settings - Fork 2
Amounts and units polish, part 2 #1902
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
Conversation
| expect(new UnitModel(99999.133, 'uL').as('L').toString()).toBe('0.099999133 L'); | ||
| expect(new UnitModel(99999.13345678, 'uL').as('L').toString()).toBe('0.099999133 L'); | ||
| expect(new UnitModel(99999.13345678, 'mg').as('kg').toString()).toBe('0.099999133457 kg'); | ||
| expect(new UnitModel(99999.13345678, 'mg').as('kg').toString()).toBe('0.09999913345678 kg'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhere we should also have a verification of an amount that is rounded in the UI.
| return false; | ||
| } | ||
|
|
||
| export const isValidSampleAmountWithError = (v: any): any => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love the name of this method. Since it's really just returning an error message for invalid amounts, perhaps getInvalidSampleAmountMessage would be appropriate.
| value: UNITS_KIND.COUNT, | ||
| label: 'Other', | ||
| hideSubSelect: true, | ||
| msg: 'Amounts can be entered as unit, pcs, pack, blocks, slides, cells, box, kit, tests, or bottle and won’t be converted.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alphabetization here would be more consistent and readable.
| value: UNITS_KIND.NONE, | ||
| label: 'Any', | ||
| hideSubSelect: true, | ||
| msg: 'Amounts can be entered in any unit and won’t be converted.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps "won't be converted when stored or displayed?" (I'm not sure users know when or why conversions happen.)
Rationale
Support more unit types and validate amount input values
Related Pull Requests
Changes
sampleAmountfor validating sample amount/units input on forms