Skip to content

Commit

Permalink
Merge branch 'chore_release-7.1.0' into components_fix-storybook-deck…
Browse files Browse the repository at this point in the history
…-configurator
  • Loading branch information
koji committed Dec 12, 2023
2 parents 3481eec + 1a81b72 commit 4c036e3
Show file tree
Hide file tree
Showing 474 changed files with 62,470 additions and 7,945 deletions.
44 changes: 43 additions & 1 deletion api-client/src/protocols/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ describe('parseInitialLoadedLabwareByAdapter', () => {
})
})
describe('parseInitialLoadedLabwareBySlot', () => {
it('returns only labware loaded in slots', () => {
it('returns labware loaded in slots', () => {
const expected = {
2: mockRunTimeCommands.find(
c =>
Expand All @@ -282,6 +282,48 @@ describe('parseInitialLoadedLabwareBySlot', () => {
expected
)
})
it('returns labware loaded in addressable areas', () => {
const mockAddressableAreaLoadedLabwareCommand = ([
{
id: 'commands.LOAD_LABWARE-3',
createdAt: '2022-04-01T15:46:01.745870+00:00',
commandType: 'loadLabware',
key: 'commands.LOAD_LABWARE-3',
status: 'succeeded',
params: {
location: {
addressableAreaName: 'D4',
},
loadName: 'nest_96_wellplate_100ul_pcr_full_skirt',
namespace: 'opentrons',
version: 1,
labwareId: null,
displayName: 'NEST 96 Well Plate 100 µL PCR Full Skirt',
},
result: {
labwareId: 'labware-3',
definition: {},
offsetId: null,
},
error: null,
startedAt: '2022-04-01T15:46:01.745870+00:00',
completedAt: '2022-04-01T15:46:01.745870+00:00',
},
] as any) as RunTimeCommand[]

const expected = {
D4: mockAddressableAreaLoadedLabwareCommand.find(
c =>
c.commandType === 'loadLabware' &&
typeof c.params.location === 'object' &&
'addressableAreaName' in c.params?.location &&
c.params?.location?.addressableAreaName === 'D4'
),
}
expect(
parseInitialLoadedLabwareBySlot(mockAddressableAreaLoadedLabwareCommand)
).toEqual(expected)
})
})
describe('parseInitialLoadedLabwareByModuleId', () => {
it('returns only labware loaded in modules', () => {
Expand Down
73 changes: 10 additions & 63 deletions api-client/src/protocols/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import type {
ModuleModel,
PipetteName,
RunTimeCommand,
AddressableAreaName,
} from '@opentrons/shared-data'

interface PipetteNamesByMount {
Expand Down Expand Up @@ -118,11 +117,14 @@ export function parseInitialLoadedLabwareBySlot(
return reduce<LoadLabwareRunTimeCommand, LoadedLabwareBySlot>(
loadLabwareCommandsReversed,
(acc, command) => {
if (
typeof command.params.location === 'object' &&
'slotName' in command.params.location
) {
return { ...acc, [command.params.location.slotName]: command }
if (typeof command.params.location === 'object') {
let slot: string
if ('slotName' in command.params.location) {
slot = command.params.location.slotName
} else if ('addressableAreaName' in command.params.location) {
slot = command.params.location.addressableAreaName
} else return acc
return { ...acc, [slot]: command }
} else {
return acc
}
Expand Down Expand Up @@ -246,63 +248,6 @@ export function parseInitialLoadedFixturesByCutout(
)
}

export function parseAllAddressableAreas(
commands: RunTimeCommand[]
): AddressableAreaName[] {
return commands.reduce<AddressableAreaName[]>((acc, command) => {
if (
command.commandType === 'moveLabware' &&
command.params.newLocation !== 'offDeck' &&
'slotName' in command.params.newLocation &&
!acc.includes(command.params.newLocation.slotName as AddressableAreaName)
) {
return [
...acc,
command.params.newLocation.slotName as AddressableAreaName,
]
} else if (
command.commandType === 'moveLabware' &&
command.params.newLocation !== 'offDeck' &&
'addressableAreaName' in command.params.newLocation &&
!acc.includes(
command.params.newLocation.addressableAreaName as AddressableAreaName
)
) {
return [
...acc,
command.params.newLocation.addressableAreaName as AddressableAreaName,
]
} else if (
(command.commandType === 'loadLabware' ||
command.commandType === 'loadModule') &&
command.params.location !== 'offDeck' &&
'slotName' in command.params.location &&
!acc.includes(command.params.location.slotName as AddressableAreaName)
) {
return [...acc, command.params.location.slotName as AddressableAreaName]
} else if (
command.commandType === 'loadLabware' &&
command.params.location !== 'offDeck' &&
'addressableAreaName' in command.params.location &&
!acc.includes(
command.params.location.addressableAreaName as AddressableAreaName
)
) {
return [
...acc,
command.params.location.addressableAreaName as AddressableAreaName,
]
} else if (
command.commandType === 'moveToAddressableArea' &&
!acc.includes(command.params.addressableAreaName as AddressableAreaName)
) {
return [...acc, command.params.addressableAreaName as AddressableAreaName]
} else {
return acc
}
}, [])
}

export interface LiquidsById {
[liquidId: string]: {
displayName: string
Expand Down Expand Up @@ -352,10 +297,12 @@ interface LabwareLiquidInfo {
volumeByWell: { [well: string]: number }
}

/** @deprecated instead use LabwareByLiquidId from components/src/hardware-sim/ProtocolDeck/types */
export interface LabwareByLiquidId {
[liquidId: string]: LabwareLiquidInfo[]
}

/** @deprecated instead use getLabwareInfoByLiquidId from components/src/hardware-sim/ProtocolDeck/utils */
export function parseLabwareInfoByLiquidId(
commands: RunTimeCommand[]
): LabwareByLiquidId {
Expand Down
Loading

0 comments on commit 4c036e3

Please sign in to comment.