Skip to content

Conversation

@XingY
Copy link
Contributor

@XingY XingY commented Nov 17, 2025

{
providedValue = value + " (" + _sampleType.getMetricUnit() + ")";
}
validateValue(col, value, providedValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

a lot of the code in this PR is related to tracking / passing of the provided value. However, doesn't the error message end up as "Amounts must be non-negative." anyway? I don't see where it includes the provided or converted value? Seems like if that values isn't being used in the error message why worry about piping it through all of these places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "Amounts must be non-negative." is appended (instead of replacing) to the default "Value '-1.1' for field 'Amount' is invalid." error. So the full error would be: "Value '-1.1' for field 'Amount' is invalid. Amounts must be non-negative.".

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. That makes more sense. Still a bummer that we have to pass through this provided value to so many places. Was the specifically requested? In the app editable grid, you see a different error because of the client side check (I assume, haven't tested). So would this converted value only show in the error for a file import case?

Copy link
Contributor Author

@XingY XingY Nov 17, 2025

Choose a reason for hiding this comment

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

The error is shown not just for file import, but also in UI edits. The app behavior is inconsistent. Editable grid would prevent you from submit because there is cell validation that fails for negative values. For bulk/detail edit, due to the change done in for https://www.labkey.org/issues/home/Developer/issues/details.view?issueId=53979 that uses text instead of numeric input type, we instead rely on server side validation. At the moment, bulk update will show user entered amount in the error message. But detail edit instead shows converted (sampleTypeUnit).

Because we are getting rid of row-by-row update code very soon, I didn't bother making the 2 code path consistent and went with the easier approach for row-by-row.

@XingY XingY requested a review from cnathe November 20, 2025 18:08
@XingY XingY merged commit cb3a736 into develop Nov 20, 2025
15 checks passed
@XingY XingY deleted the fb_amountValidation branch November 20, 2025 21:54
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