Skip to content

Conversation

@XingY
Copy link
Contributor

@XingY XingY commented Dec 3, 2025

Rationale

Support more unit types and validate amount input values

Related Pull Requests

Changes

  • Introduced a two-tier unit selection system (Amount Type, Display Units) in sample designer
  • Added new measurement units (ug, ng) with updated display precision for existing units
  • Added a new formsy rule sampleAmount for validating sample amount/units input on forms
  • Disallow large amount (>1.79769E308) for amounts input on form, editable grid, and sample storage editor

This comment was marked as resolved.

@LabKey LabKey deleted a comment from Copilot AI Dec 3, 2025
@XingY XingY requested a review from labkey-susanh December 4, 2025 18:20
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');
Copy link
Contributor

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 => {
Copy link
Contributor

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.',
Copy link
Contributor

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.',
Copy link
Contributor

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.)

@XingY XingY merged commit 9af227b into develop Dec 8, 2025
3 checks passed
@XingY XingY deleted the fb_unitTypes branch December 8, 2025 19:52
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.

3 participants