Skip to content

Commit 881f17e

Browse files
authored
fix(app): fix quick transfer waste chute option issue (#20183)
* fix(app): fix quick transfer waste chute option issue
1 parent 07fec69 commit 881f17e

File tree

3 files changed

+79
-22
lines changed

3 files changed

+79
-22
lines changed

app/src/organisms/ODD/QuickTransferFlow/Dispense/hooks/useDispenseSettingsConfig.ts

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,35 @@ export function useDispenseSettingsConfig({
5555
return t('blow_out_into_waste_chute')
5656
}
5757
}
58+
const getDisposalVolumeLocationCopy = (): string => {
59+
if (state.disposalVolumeDispenseSettings?.blowOutLocation == null) {
60+
return t('trashBin')
61+
}
62+
if (
63+
state.disposalVolumeDispenseSettings.blowOutLocation ===
64+
SOURCE_WELL_BLOWOUT_DESTINATION
65+
) {
66+
return t('blow_out_source_well')
67+
}
68+
if (
69+
typeof state.disposalVolumeDispenseSettings.blowOutLocation ===
70+
'object' &&
71+
state.disposalVolumeDispenseSettings.blowOutLocation.cutoutFixtureId ===
72+
TRASH_BIN_ADAPTER_FIXTURE
73+
) {
74+
return t('trashBin')
75+
}
76+
if (
77+
typeof state.disposalVolumeDispenseSettings.blowOutLocation ===
78+
'object' &&
79+
WASTE_CHUTE_FIXTURES.includes(
80+
state.disposalVolumeDispenseSettings.blowOutLocation.cutoutFixtureId
81+
)
82+
) {
83+
return t('wasteChute')
84+
}
85+
return t('trashBin')
86+
}
5887

5988
const touchTipEnabled = getIsTouchTipEnabled(state.destination)
6089
const hasLiquidClass = state.liquidClassName !== 'none'
@@ -197,11 +226,7 @@ export function useDispenseSettingsConfig({
197226
state.disposalVolumeDispenseSettings != null && isMultiTransfer
198227
? t('disposal_volume_label', {
199228
volume: state.disposalVolumeDispenseSettings.volume,
200-
location:
201-
state.disposalVolumeDispenseSettings.blowOutLocation ===
202-
SOURCE_WELL_BLOWOUT_DESTINATION
203-
? t('blow_out_source_well')
204-
: t('trashBin'),
229+
location: getDisposalVolumeLocationCopy(),
205230
flowRate: state.disposalVolumeDispenseSettings.flowRate,
206231
})
207232
: t('option_disabled'),

app/src/organisms/ODD/QuickTransferFlow/QuickTransferAdvancedSettings/DisposalVolume.tsx

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
StyledText,
1515
} from '@opentrons/components'
1616
import {
17+
FLEX_SINGLE_SLOT_BY_CUTOUT_ID,
1718
getTipTypeFromTipRackDefinition,
1819
LOW_VOLUME_PIPETTES,
1920
TRASH_BIN_ADAPTER_FIXTURE,
@@ -65,41 +66,62 @@ export function DisposalVolume(props: DisposalVolumeProps): JSX.Element {
6566
if (typeof blowOut.location === 'string') {
6667
return blowOut.location
6768
}
68-
return `trashBin:${blowOut.location.cutoutId}`
69+
if (
70+
'cutoutFixtureId' in blowOut.location &&
71+
typeof blowOut.location.cutoutFixtureId === 'string' &&
72+
WASTE_CHUTE_FIXTURES.includes(blowOut.location.cutoutFixtureId)
73+
) {
74+
return `wasteChute:${blowOut.location.cutoutId}`
75+
}
76+
if ('cutoutId' in blowOut.location) {
77+
return `trashBin:${blowOut.location.cutoutId}`
78+
}
79+
return ''
6980
}
7081

7182
const [selectedBlowoutLocation, setSelectedBlowoutLocation] =
7283
useState<string>(getInitialBlowoutLocation(state.blowOutDispense))
7384
const [flowRate, setFlowRate] = useState<number | null>(null)
7485
const deckConfig = useNotifyDeckConfigurationQuery().data ?? []
75-
const fixtureLocationOptions = deckConfig.filter(
76-
cutoutConfig =>
77-
WASTE_CHUTE_FIXTURES.includes(cutoutConfig.cutoutFixtureId) ||
78-
TRASH_BIN_ADAPTER_FIXTURE === cutoutConfig.cutoutFixtureId
79-
)
80-
81-
const trashBinCutoutId = fixtureLocationOptions.find(
82-
option => option.cutoutFixtureId === TRASH_BIN_ADAPTER_FIXTURE
83-
)?.cutoutId
8486

87+
const trashBinCutoutConfig = deckConfig.find(
88+
cutoutConfig => cutoutConfig.cutoutFixtureId === TRASH_BIN_ADAPTER_FIXTURE
89+
)
8590
const trashBinOption: BlowOutLocation | undefined =
86-
trashBinCutoutId != null
91+
trashBinCutoutConfig != null
8792
? {
88-
cutoutId: trashBinCutoutId,
93+
cutoutId: trashBinCutoutConfig.cutoutId,
8994
cutoutFixtureId: TRASH_BIN_ADAPTER_FIXTURE,
9095
}
9196
: undefined
9297

98+
const wasteChuteOptions = deckConfig
99+
.filter(
100+
option =>
101+
typeof option.cutoutFixtureId === 'string' &&
102+
WASTE_CHUTE_FIXTURES.includes(option.cutoutFixtureId)
103+
)
104+
.map(option => ({
105+
option,
106+
value: `wasteChute:${option.cutoutId}`,
107+
description: t('wasteChute_location', {
108+
slotName: FLEX_SINGLE_SLOT_BY_CUTOUT_ID[option.cutoutId],
109+
}),
110+
}))
111+
93112
const blowoutLocationOptions = [
94113
...(trashBinOption != null
95114
? [
96115
{
97116
option: trashBinOption,
98117
value: `trashBin:${trashBinOption.cutoutId}`,
99-
description: t('trashBin'),
118+
description: t('trashBin_location', {
119+
slotName: FLEX_SINGLE_SLOT_BY_CUTOUT_ID[trashBinOption.cutoutId],
120+
}),
100121
},
101122
]
102123
: []),
124+
...wasteChuteOptions,
103125
{
104126
option: SOURCE_WELL_BLOWOUT_DESTINATION,
105127
value: SOURCE_WELL_BLOWOUT_DESTINATION,
@@ -113,11 +135,14 @@ export function DisposalVolume(props: DisposalVolumeProps): JSX.Element {
113135
const flowRatesForSupportedTip: SupportedTip | undefined =
114136
state.volume < 5 &&
115137
`lowVolumeDefault` in liquidSpecs &&
138+
typeof pipetteName === 'string' &&
116139
LOW_VOLUME_PIPETTES.includes(pipetteName)
117140
? liquidSpecs.lowVolumeDefault.supportedTips[tipType]
118141
: liquidSpecs.default.supportedTips[tipType]
119142
const minFlowRate = 0.1
120-
const maxFlowRate = Math.floor(flowRatesForSupportedTip?.uiMaxFlowRate ?? 0)
143+
const maxFlowRate = Math.floor(
144+
(flowRatesForSupportedTip?.uiMaxFlowRate ?? 0) as number
145+
)
121146

122147
const flowRateError =
123148
flowRate != null && (flowRate < minFlowRate || flowRate > maxFlowRate)
@@ -145,11 +170,17 @@ export function DisposalVolume(props: DisposalVolumeProps): JSX.Element {
145170
return
146171
}
147172

173+
const selectedOption = blowoutLocationOptions.find(
174+
opt => opt.value === selectedBlowoutLocation
175+
)
176+
const blowOutLocation: BlowOutLocation =
177+
selectedOption?.option ?? (selectedBlowoutLocation as BlowOutLocation)
178+
148179
dispatch({
149180
type: ACTIONS.SET_DISPOSAL_VOLUME_DISPENSE,
150181
disposalVolumeDispenseSettings: {
151182
volume,
152-
blowOutLocation: selectedBlowoutLocation as BlowOutLocation,
183+
blowOutLocation,
153184
flowRate,
154185
},
155186
})
@@ -257,7 +288,8 @@ export function DisposalVolume(props: DisposalVolumeProps): JSX.Element {
257288
key={option.value}
258289
isSelected={selectedBlowoutLocation === option.value}
259290
onChange={() => {
260-
setSelectedBlowoutLocation(option.value)
291+
const value = String(option.value)
292+
setSelectedBlowoutLocation(value)
261293
}}
262294
buttonValue={option.value}
263295
buttonLabel={option.description}

app/src/organisms/ODD/QuickTransferFlow/QuickTransferAdvancedSettings/__tests__/DisposalVolume.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe('DisposalVolume', () => {
8383
await user.click(screen.getByText('Continue'))
8484
screen.getByText('Select blowout location')
8585
screen.getByText('Continue')
86-
screen.getByText('Trash bin')
86+
screen.getByText('Trash bin in C3')
8787
screen.getByText('Source well')
8888
})
8989

0 commit comments

Comments
 (0)