Skip to content

Commit

Permalink
fix(app): no longer consider labware loaded late in protocol off-deck (
Browse files Browse the repository at this point in the history
  • Loading branch information
smb2268 authored Dec 4, 2024
1 parent c1f355c commit 607e119
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 55 deletions.
39 changes: 12 additions & 27 deletions app/src/organisms/Desktop/ProtocolDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ import {
getGripperDisplayName,
getModuleType,
getSimplestDeckConfigForProtocol,
parseInitialLoadedLabwareByAdapter,
parseInitialLoadedLabwareByModuleId,
parseInitialLoadedLabwareBySlot,
parseInitialLoadedModulesBySlot,
parseInitialPipetteNamesByMount,
} from '@opentrons/shared-data'
Expand Down Expand Up @@ -75,7 +72,11 @@ import { RobotConfigurationDetails } from './RobotConfigurationDetails'
import { ProtocolParameters } from './ProtocolParameters'
import { AnnotatedSteps } from './AnnotatedSteps'

import type { JsonConfig, PythonConfig } from '@opentrons/shared-data'
import type {
JsonConfig,
PythonConfig,
LoadLabwareRunTimeCommand,
} from '@opentrons/shared-data'
import type { StoredProtocolData } from '/app/redux/protocol-storage'
import type { State, Dispatch } from '/app/redux/types'

Expand Down Expand Up @@ -265,28 +266,12 @@ export function ProtocolDetails(
: null
)

const requiredLabwareDetails =
mostRecentAnalysis != null
? map({
...parseInitialLoadedLabwareByModuleId(
mostRecentAnalysis.commands != null
? mostRecentAnalysis.commands
: []
),
...parseInitialLoadedLabwareBySlot(
mostRecentAnalysis.commands != null
? mostRecentAnalysis.commands
: []
),
...parseInitialLoadedLabwareByAdapter(
mostRecentAnalysis.commands != null
? mostRecentAnalysis.commands
: []
),
}).filter(
labware => labware.result?.definition?.parameters?.format !== 'trash'
)
: []
const loadLabwareCommands =
mostRecentAnalysis?.commands.filter(
(command): command is LoadLabwareRunTimeCommand =>
command.commandType === 'loadLabware' &&
command.result?.definition.parameters.format !== 'trash'
) ?? []

const protocolDisplayName = getProtocolDisplayName(
protocolKey,
Expand Down Expand Up @@ -323,7 +308,7 @@ export function ProtocolDetails(

const contentsByTabName = {
labware: (
<ProtocolLabwareDetails requiredLabwareDetails={requiredLabwareDetails} />
<ProtocolLabwareDetails requiredLabwareDetails={loadLabwareCommands} />
),
robot_config: (
<RobotConfigurationDetails
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,6 @@ export interface GroupedLabwareSetupItems {
export function getLabwareSetupItemGroups(
commands: RunTimeCommand[]
): GroupedLabwareSetupItems {
let beyondInitialLoadCommands = false

const LABWARE_ACCESS_COMMAND_TYPES = [
'moveToWell',
'aspirate',
'dispense',
'blowout',
'pickUpTip',
'dropTip',
'touchTip',
]

const [offDeckItems, onDeckItems] = partition(
commands.reduce<LabwareSetupItem[]>((acc, c) => {
if (
Expand Down Expand Up @@ -77,30 +65,15 @@ export function getLabwareSetupItemGroups(
return [
...acc,
{
// NOTE: for the purposes of the labware setup step, anything loaded after
// the initial load commands will be treated as "initially off deck"
// even if technically loaded directly onto the deck later in the protocol
initialLocation: beyondInitialLoadCommands
? 'offDeck'
: c.params.location,
initialLocation: c.params.location,
definition,
moduleModel,
moduleLocation,
nickName,
labwareId: c.result?.labwareId,
},
]
} else if (
!beyondInitialLoadCommands &&
LABWARE_ACCESS_COMMAND_TYPES.includes(c.commandType) &&
!(
c.commandType === 'moveLabware' &&
c.params.strategy === 'manualMoveWithoutPause'
)
) {
beyondInitialLoadCommands = true
}

return acc
}, []),
({ initialLocation }) => initialLocation === 'offDeck'
Expand Down

0 comments on commit 607e119

Please sign in to comment.