-
Notifications
You must be signed in to change notification settings - Fork 184
fix(protocol-designer): allow moving labware on top of adapters #18541
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
} from '@opentrons/shared-data' | ||
import { | ||
COLUMN_4_SLOTS, | ||
getSlotInLocationStack, | ||
getTopLocationInStack, | ||
} from '@opentrons/step-generation' | ||
|
||
|
@@ -185,11 +186,19 @@ | |
|
||
const unoccupiedAdapterOptions = Object.entries(labware).reduce<Option[]>( | ||
(acc, [labwareId, labwareOnDeck]) => { | ||
const labwareOnAdapter = Object.values(labware).find( | ||
temporalProperties => | ||
getTopLocationInStack(temporalProperties.stack) === labwareId | ||
const hasLabwareAboveAdapter = Object.values(labware).reduce( | ||
(acc, temporalProperties) => { | ||
if (temporalProperties.stack.includes(labwareId)) { | ||
const topId = getTopLocationInStack(temporalProperties.stack) | ||
if (topId !== labwareId) { | ||
return true | ||
} | ||
} | ||
return acc | ||
}, | ||
false | ||
) | ||
const adapterSlot = getTopLocationInStack(labwareOnDeck.stack) | ||
const adapterSlot = getSlotInLocationStack(labwareOnDeck.stack) | ||
const modIdWithAdapter = Object.keys(modules).find(modId => | ||
labwareOnDeck.stack.includes(modId) | ||
) | ||
|
@@ -204,7 +213,8 @@ | |
: 'unknown module' | ||
const moduleSlotInfo = modSlot ?? 'unknown slot' | ||
const adapterSlotInfo = adapterSlot ?? 'unknown adapter' | ||
return labwareOnAdapter == null && isAdapter | ||
|
||
return isAdapter && !hasLabwareAboveAdapter | ||
? [ | ||
...acc, | ||
{ | ||
|
@@ -223,7 +233,7 @@ | |
const unoccupiedModuleOptions = Object.entries(modules).reduce<Option[]>( | ||
(acc, [modId, modOnDeck]) => { | ||
const moduleHasLabware = Object.entries(labware).some( | ||
([_, lwOnDeck]) => lwOnDeck.stack[0] === modId | ||
([_, lwOnDeck]) => lwOnDeck.stack[lwOnDeck.stack.length - 2] === modId | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is this logic? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the module id in the stack will be the 2nd item in the stack array from the end of the array. So if the stack includes the module id, then we know the module has labware. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see. I worry slightly about hardcoding in that index as our stacking capabilities theoretically expand. For example— what if you have a lid on top of a labware on top of an adapter on top of a module? While it might be overkill for now, I recommend a utility for like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The module id will always be in the same index of the array though: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes that works! |
||
) | ||
const type = moduleEntities[modId].type | ||
const slot = modOnDeck.slot | ||
|
Uh oh!
There was an error while loading. Please reload this page.