Skip to content

Commit

Permalink
fix(app): instead filter magnetic blocks (not magnetic modules) out o…
Browse files Browse the repository at this point in the history
…f the required modules (#15232)

Fix bug where we were accidentally filtering magnetic modules instead of
magnetic blocks from the
required modules list from analysis.

Closes [RQA-2754](https://opentrons.atlassian.net/browse/RQA-2754)
  • Loading branch information
b-cooper authored May 21, 2024
1 parent 4dfd608 commit 21572f0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
21 changes: 15 additions & 6 deletions app/src/pages/ProtocolDetails/Hardware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {
getModuleType,
getFixtureDisplayName,
GRIPPER_V1_2,
MAGNETIC_BLOCK_FIXTURES,
MAGNETIC_BLOCK_TYPE,
} from '@opentrons/shared-data'

import {
Expand Down Expand Up @@ -119,26 +121,33 @@ function HardwareItem({
<LocationIcon slotName={getCutoutDisplayName(hardware.location.cutout)} />
)
}
const isMagneticBlockFixture =
hardware.hardwareType === 'fixture' &&
hardware.cutoutFixtureId != null &&
MAGNETIC_BLOCK_FIXTURES.includes(hardware.cutoutFixtureId)
let iconModuleType = null
if (hardware.hardwareType === 'module') {
iconModuleType = getModuleType(hardware.moduleModel)
} else if (isMagneticBlockFixture) {
iconModuleType = MAGNETIC_BLOCK_TYPE
}
return (
<TableRow>
<TableDatum>
<Flex paddingLeft={SPACING.spacing24}>{location}</Flex>
</TableDatum>
<TableDatum>
<Flex paddingLeft={SPACING.spacing24}>
{hardware.hardwareType === 'module' && (
{iconModuleType != null ? (
<Flex
alignItems={ALIGN_CENTER}
height="2rem"
paddingBottom={SPACING.spacing4}
paddingRight={SPACING.spacing8}
>
<ModuleIcon
moduleType={getModuleType(hardware.moduleModel)}
size="1.75rem"
/>
<ModuleIcon moduleType={iconModuleType} size="1.75rem" />
</Flex>
)}
) : null}
<StyledText as="p">{hardwareName}</StyledText>
</Flex>
</TableDatum>
Expand Down
5 changes: 3 additions & 2 deletions app/src/pages/Protocols/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
getCutoutFixturesForModuleModel,
FLEX_MODULE_ADDRESSABLE_AREAS,
getModuleType,
MAGNETIC_MODULE_TYPE,
FLEX_USB_MODULE_ADDRESSABLE_AREAS,
MAGNETIC_BLOCK_TYPE,
} from '@opentrons/shared-data'
import { getLabwareSetupItemGroups } from '../utils'
import { getProtocolUsesGripper } from '../../../organisms/ProtocolSetupInstruments/utils'
Expand Down Expand Up @@ -111,7 +111,8 @@ export const useRequiredProtocolHardwareFromAnalysis = (
: []

const requiredModules: ProtocolModule[] = analysis.modules
.filter(m => getModuleType(m.model) !== MAGNETIC_MODULE_TYPE)
// remove magnetic blocks, they're handled by required fixtures
.filter(m => getModuleType(m.model) !== MAGNETIC_BLOCK_TYPE)
.map(({ location, model }) => {
const cutoutIdForSlotName = getCutoutIdForSlotName(
location.slotName,
Expand Down

0 comments on commit 21572f0

Please sign in to comment.