Skip to content

Commit

Permalink
refactor(protocol-designer): reimporting protocol with deck config fi…
Browse files Browse the repository at this point in the history
…xes (#14083)

closes RAUT-890
  • Loading branch information
jerader authored Dec 4, 2023
1 parent db19a71 commit 6c53a94
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,15 @@ describe('getUnusedStagingAreas', () => {
location: 'cutoutA3',
},
} as AdditionalEquipment
const mockCommand = ([
const mockCommand = [
{
stagingArea: {
commandType: 'loadLabware',
params: { location: { slotName: 'A4' } },
},
commandType: 'loadLabware',
params: { location: { addressableAreaName: 'A4' } },
},
] as unknown) as CreateCommand[]
] as CreateCommand[]

expect(
getUnusedStagingAreas(mockAdditionalEquipment, mockCommand)
).toEqual(['A4'])
expect(getUnusedStagingAreas(mockAdditionalEquipment, mockCommand)).toEqual(
[]
)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,19 @@ export const getUnusedStagingAreas = (

const stagingAreaCommandSlots: string[] = stagingAreaAddressableAreaNames.filter(
location =>
commands?.filter(
(commands ?? [])?.some(
command =>
(command.commandType === 'loadLabware' &&
command.params.location !== 'offDeck' &&
'slotName' in command.params.location &&
command.params.location.slotName === location) ||
'addressableAreaName' in command.params.location &&
command.params.location.addressableAreaName === location) ||
(command.commandType === 'moveLabware' &&
command.params.newLocation !== 'offDeck' &&
'slotName' in command.params.newLocation &&
command.params.newLocation.slotName === location)
'addressableAreaName' in command.params.newLocation &&
command.params.newLocation.addressableAreaName === location)
)
? location
: null
? null
: location
)

return stagingAreaCommandSlots
}
95 changes: 68 additions & 27 deletions protocol-designer/src/step-forms/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1350,16 +1350,6 @@ export const additionalEquipmentInvariantProperties = handleActions<NormalizedAd
command.params.addressableAreaName
))
)
const wasteChuteId = `${uuid()}:wasteChute`
const wasteChute = hasWasteChuteCommands
? {
[wasteChuteId]: {
name: 'wasteChute' as const,
id: wasteChuteId,
location: 'cutoutD3',
},
}
: {}

const getStagingAreaSlotNames = (
commandType: 'moveLabware' | 'loadLabware',
Expand All @@ -1370,7 +1360,7 @@ export const additionalEquipmentInvariantProperties = handleActions<NormalizedAd
command =>
command.commandType === commandType &&
command.params[locationKey] !== 'offDeck' &&
'slotName' in command.params[locationKey] &&
'addressableAreaName' in command.params[locationKey] &&
COLUMN_4_SLOTS.includes(
command.params[locationKey].addressableAreaName
)
Expand Down Expand Up @@ -1413,36 +1403,45 @@ export const additionalEquipmentInvariantProperties = handleActions<NormalizedAd
const trashAddressableAreaName =
trashBinCommand?.params.addressableAreaName
const savedStepForms = file.designerApplication?.data?.savedStepForms
const moveLiquidStep =
const moveLiquidStepTrashBin =
savedStepForms != null
? Object.values(savedStepForms).find(
stepForm =>
stepForm.stepType === 'moveLiquid' &&
(stepForm.aspirate_labware.includes('trashBin') ||
stepForm.dispense_labware.includes('trashBin') ||
stepForm.dropTip_location.includes('trashBin') ||
stepForm.blowout_location.includes('trashBin'))
stepForm.blowout_location?.includes('trashBin'))
)
: null

let trashBinId: string | null = null
if (moveLiquidStep != null) {
if (moveLiquidStep.aspirate_labware.includes('trashBin')) {
trashBinId = moveLiquidStep.aspirate_labware
} else if (moveLiquidStep.dispense_labware.includes('trashBin')) {
trashBinId = moveLiquidStep.dispense_labware
} else if (moveLiquidStep.dropTip_location.includes('trashBin')) {
trashBinId = moveLiquidStep.dropTip_location
} else if (moveLiquidStep.blowOut_location.includes('trashBin')) {
trashBinId = moveLiquidStep.blowOut_location
if (moveLiquidStepTrashBin != null) {
if (moveLiquidStepTrashBin.aspirate_labware.includes('trashBin')) {
trashBinId = moveLiquidStepTrashBin.aspirate_labware
} else if (
moveLiquidStepTrashBin.dispense_labware.includes('trashBin')
) {
trashBinId = moveLiquidStepTrashBin.dispense_labware
} else if (
moveLiquidStepTrashBin.dropTip_location.includes('trashBin')
) {
trashBinId = moveLiquidStepTrashBin.dropTip_location
} else if (
moveLiquidStepTrashBin.blowOut_location?.includes('trashBin')
) {
trashBinId = moveLiquidStepTrashBin.blowOut_location
}
}

const trashCutoutId = getCutoutIdByAddressableArea(
trashAddressableAreaName as AddressableAreaName,
isFlex ? 'trashBinAdapter' : 'fixedTrashSlot',
isFlex ? FLEX_ROBOT_TYPE : OT2_ROBOT_TYPE
)
const trashCutoutId =
trashAddressableAreaName != null
? getCutoutIdByAddressableArea(
trashAddressableAreaName as AddressableAreaName,
isFlex ? 'trashBinAdapter' : 'fixedTrashSlot',
isFlex ? FLEX_ROBOT_TYPE : OT2_ROBOT_TYPE
)
: null
const trashBin =
trashAddressableAreaName != null && trashBinId != null
? {
Expand All @@ -1461,6 +1460,48 @@ export const additionalEquipmentInvariantProperties = handleActions<NormalizedAd
)
}

const moveLiquidStepWasteChute =
savedStepForms != null
? Object.values(savedStepForms).find(
stepForm =>
stepForm.stepType === 'moveLiquid' &&
(stepForm.aspirate_labware.includes('wasteChute') ||
stepForm.dispense_labware.includes('wasteChute') ||
stepForm.dropTip_location.includes('wasteChute') ||
stepForm.blowout_location?.includes('wasteChute'))
)
: null

let wasteChuteId: string | null = null
if (hasWasteChuteCommands && moveLiquidStepWasteChute != null) {
if (moveLiquidStepWasteChute.aspirate_labware.includes('wasteChute')) {
wasteChuteId = moveLiquidStepWasteChute.aspirate_labware
} else if (
moveLiquidStepWasteChute.dispense_labware.includes('wasteChute')
) {
wasteChuteId = moveLiquidStepWasteChute.dispense_labware
} else if (
moveLiquidStepWasteChute.dropTip_location.includes('wasteChute')
) {
wasteChuteId = moveLiquidStepWasteChute.dropTip_location
} else if (
moveLiquidStepWasteChute.blowOut_location?.includes('wasteChute')
) {
wasteChuteId = moveLiquidStepWasteChute.blowOut_location
}
}

const wasteChute =
hasWasteChuteCommands && wasteChuteId != null
? {
[wasteChuteId]: {
name: 'wasteChute' as const,
id: wasteChuteId,
location: 'cutoutD3',
},
}
: {}

const gripperId = `${uuid()}:gripper`
const gripper = hasGripperCommands
? {
Expand Down

0 comments on commit 6c53a94

Please sign in to comment.