Skip to content

Commit

Permalink
clean up logic for hard-coded trashBin and wasteChute
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Feb 4, 2025
1 parent c2ce56d commit 1f240e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"733ba018-3550-476c-9fa3-0b5259d1a1d6": "left"
},
"trashBinLocationUpdate": {
"dc2c4599-29b3-4ec8-adff-56677ac0821e:fixedTrash": "cutout12"
"dc2c4599-29b3-4ec8-adff-56677ac0821e:trashBin": "cutout12"
},
"wasteChuteLocationUpdate": {},
"stagingAreaLocationUpdate": {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,6 @@ export const getAdditionalEquipmentLocationUpdate = (
)
: null

Check warning on line 158 in protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts#L150-L158

Added lines #L150 - L158 were not covered by tests

if (trashBinCommand == null && robotType === OT2_ROBOT_TYPE) {
console.error(
'expected to find a fixedTrash command for the OT-2 but could not'
)
}

const moveLiquidStepWasteChute =
savedStepForms != null
? Object.values(savedStepForms).find(
Expand Down Expand Up @@ -211,7 +205,7 @@ export const getAdditionalEquipmentLocationUpdate = (
}
: {}

Check warning on line 206 in protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts#L201-L206

Added lines #L201 - L206 were not covered by tests

const hardcodedTrashBinIdOt2 = `${uuid()}:fixedTrash`
const hardcodedTrashBinIdOt2 = `${uuid()}:trashBin`
const hardcodedTrashBinOt2 = {
[hardcodedTrashBinIdOt2]: getCutoutIdByAddressableArea(
'fixedTrash' as AddressableAreaName,
Expand All @@ -220,30 +214,6 @@ export const getAdditionalEquipmentLocationUpdate = (
),
}

Check warning on line 215 in protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts#L208-L215

Added lines #L208 - L215 were not covered by tests

const hardcodedTrashAddressableAreaName =
unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT
? 'wasteChute'
: `movableTrash${unoccupiedSlotForTrash}`

const hardcodedTrashIdFlex = `${uuid()}:${hardcodedTrashAddressableAreaName}`

const hardCodedTrashLocation =
unoccupiedSlotForTrash === ''
? ''
: unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT
? WASTE_CHUTE_CUTOUT
: getCutoutIdByAddressableArea(
hardcodedTrashAddressableAreaName as AddressableAreaName,
'trashBinAdapter',
FLEX_ROBOT_TYPE
)

const hardcodedTrashFlex = {
[hardcodedTrashIdFlex]: hasWasteChuteCommands
? WASTE_CHUTE_CUTOUT
: hardCodedTrashLocation,
}

let trashBinLocationUpdate: LocationUpdate = hasWasteChuteCommands
? {}
: hardcodedTrashBinOt2

Check warning on line 219 in protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts#L217-L219

Added lines #L217 - L219 were not covered by tests
Expand All @@ -252,11 +222,27 @@ export const getAdditionalEquipmentLocationUpdate = (
trashBinLocationUpdate = {
[trashBinId]: trashCutoutId as string,
}

Check warning on line 224 in protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts#L221-L224

Added lines #L221 - L224 were not covered by tests
// in case the user has no pipetting steps, auto-generate a trashBin or wasteChute entity for Flex
} else if (isFlex && !hasWasteChuteCommands) {
const hardCodedTrashIdFlex = `${uuid()}:movableTrash${unoccupiedSlotForTrash}`
const hardCodedWasteChuteId = `${uuid()}:wasteChute`

Check warning on line 228 in protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts#L226-L228

Added lines #L226 - L228 were not covered by tests

trashBinLocationUpdate =
unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT ? {} : hardcodedTrashFlex
unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT
? {}
: {
[hardCodedTrashIdFlex]: getCutoutIdByAddressableArea(
`movableTrash${unoccupiedSlotForTrash}` as AddressableAreaName,
'trashBinAdapter',
FLEX_ROBOT_TYPE
),
}
wasteChuteLocationUpdate =
unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT ? hardcodedTrashFlex : {}
unoccupiedSlotForTrash === WASTE_CHUTE_CUTOUT
? {
[hardCodedWasteChuteId]: WASTE_CHUTE_CUTOUT,
}
: {}
}

Check warning on line 246 in protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts

View check run for this annotation

Codecov / codecov/patch

protocol-designer/src/load-file/migration/utils/getAdditionalEquipmentLocationUpdate.ts#L230-L246

Added lines #L230 - L246 were not covered by tests

const stagingAreaLocationUpdate: LocationUpdate = stagingAreaSlotNames.reduce(
Expand Down

0 comments on commit 1f240e0

Please sign in to comment.