-
Notifications
You must be signed in to change notification settings - Fork 179
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(step-generation, protocol-designer, app): touchTip to emit from top of well origin #17375
Conversation
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.
Left a bunch of nits, mostly pertaining to testing. Only blocking fix that needs to be made that I can tell is the hypen issue in the input field
@@ -211,6 +211,7 @@ export function TouchTip(props: TouchTipProps): JSX.Element { | |||
borderRadius="0" | |||
> | |||
<NumericalKeyboard | |||
hasHyphen |
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.
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.
is this modal from PD? I'm a bit confused because you commented on the code that is part of TouchTip from Quick Transfer
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.
sorry, i left this comment in the wrong place. this is PD
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.
thanks, i think i'll leave as is and address that in a follow up. seems like it is an issue for blowOut
and touchTip
protocol-designer/src/steplist/formLevel/stepFormToArgs/mixFormToArgs.ts
Outdated
Show resolved
Hide resolved
protocol-designer/src/steplist/formLevel/stepFormToArgs/moveLiquidFormToArgs.ts
Outdated
Show resolved
Hide resolved
...rc/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/TouchTip.test.tsx
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,162 @@ | |||
import floor from 'lodash/floor' |
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.
Hm. What's the reason for lodash floor
instead of the built-in floor function?
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.
good call, i can probably just use Math.floor()
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.
oh lodash floor
allows you to specify the decimal points. math.floor()
does not. so i'll keep the lodash floor
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.
That's fine, but I meant: where in the code do you actually specify the places after the decimal then if that's what you want?
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.
we specify the places in the decimal at the form input field level. like the input field restricts users to 1 decimal. I suppose we could convert it upstream at that level. But it seems cleaner to me to convert it here in the migration. What do you think?
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.
Hm, I think I'm confused: In the code, you added stuff like
floor(
dispense_touchTip_mmFromBottom -
matchingDispenseLabwareWellDepth
),
I don't see where the rounding to 1 place after the decimal happens. Does lodash floor()
default to 1 place? The built-in Math.floor()
would just truncate it to an integer.
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.
oops i forgot to add back the decimal value. it should be this. thank you for catching this. I had it right initially but then didn't fix it when i reverted the math.floor change.
floor(
dispense_touchTip_mmFromBottom -
matchingDispenseLabwareWellDepth, 1
)
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.
Ah, gotcha!
(I'm curious if changing it to floor(..., 1)
should change the expected output in any of the tests.)
…op of well origin closes AUTH-1378
ffd9f2b
to
c5535c9
Compare
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.
As is currently, you aren't able to enter the -
on the quick transfer touch tip screen because of typing expectations with the input field. I played around with it and think this suggestion fixes the issue, but let me know if you have questions!
@@ -211,6 +211,7 @@ export function TouchTip(props: TouchTipProps): JSX.Element { | |||
borderRadius="0" | |||
> | |||
<NumericalKeyboard | |||
hasHyphen | |||
keyboardRef={keyboardRef} | |||
initialValue={String(position ?? '')} | |||
onChange={e => { |
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.
With the addition of the -
, this typing is no longer accurate. I think the type for InputField
above has to change to text
and this should be setPosition(e)
without the cast to Number
. We'll then have to update positionError
to something like this:
const positionError =
position !== null &&
(position === '-' ||
position.indexOf('-') !== position.lastIndexOf('-') ||
Number(position) < positionRange.min ||
Number(position) > positionRange.max)
? t(`value_out_of_range`, {
min: positionRange.min,
max: Math.floor(positionRange.max),
})
: null
and then handle casting from number to string when grabbing the initial values from state and then from string to number sending them via dispatch
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.
Thanks for catching this Sarah! I just pushed a fix according to your comment. Hopefully it works as expected now.
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.
OK, approving. I don't have much context for the Quick Transfer and ODD stuff, so hopefully someone else has looked at those changes.
@@ -0,0 +1,162 @@ | |||
import floor from 'lodash/floor' |
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.
Ah, gotcha!
(I'm curious if changing it to floor(..., 1)
should change the expected output in any of the tests.)
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.
Tested out the quick transfer changes and they're now working as expected! Thanks for updating
closes AUTH-1378
Overview
Previously,
touchTip
would occur from the bottom of the well, which is a bit confusing since users in python and intuitively would want to start with origin from the top. This PR migrates all touch tip fields and inverses the logic. Here is the summary of the changes:aspirate_touchTipMmFromBottom
is nowaspirate_touchTipMmFromTop
inmoveLiquid
form datadispense_touchTipMmFromBottom
is nowdispense_touchTipMmFromTop
inmoveLiquid
form datamix_touchTipMmFromBottom
is nowmix_touchTipMmFromTop
inmix
form datatouchTip
to be origin from the top of the well with the new z-index8_5_0
migration to migrate their form data z-index fields to be origin from the top of the wellTest Plan and Hands on Testing
First test that this makes sense and works in PD by testing a mix's touch tip and move liquid's aspirate and dispense touch tip. See that the modal starts from the top of the well for adjusting the position
Then test importing an old protocol and see that it migrates correclty for those fields, making sure touchtip is now origin at the top of the well and also check the form
Then test that quick transfer's touch tip on the ODD has a min/max that matches this
Changelog
update the touch tip fields and add a 8_5_0 migration file, migrating the cypress e2e tests as well
update step-generation's touch tip atomic command origin
update step args to match the new touch tip field name
fix affected tests
update quick transfer to match this change
Risk assessment
med-ish since this touches a good amount of code. But with unit and cypress tests passing, i'm confident that this change is correctly implemented