Skip to content

Commit 8bf5a71

Browse files
fix(app): Filter pipette offset calibrations by mount as well (#7017)
1 parent 3ffad55 commit 8bf5a71

File tree

7 files changed

+37
-16
lines changed

7 files changed

+37
-16
lines changed

app/src/calibration/pipette-offset/__tests__/selectors.test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ describe('getCalibrationForPipette', () => {
3939
Selectors.getCalibrationForPipette(
4040
mockState,
4141
'robot-name',
42-
'P1KVS2108052020A02'
42+
'P1KVS2108052020A02',
43+
'right'
4344
)
4445
).toEqual(Fixtures.mockPipetteOffsetCalibration3)
4546
})
@@ -48,7 +49,8 @@ describe('getCalibrationForPipette', () => {
4849
Selectors.getCalibrationForPipette(
4950
mockState,
5051
'robot-name',
51-
'no such pipette'
52+
'no such pipette',
53+
'some mount'
5254
)
5355
).toBeNull()
5456
})
@@ -57,7 +59,8 @@ describe('getCalibrationForPipette', () => {
5759
Selectors.getCalibrationForPipette(
5860
mockState,
5961
'some other robot',
60-
'P20MV2008052020A02'
62+
'P20MV2008052020A02',
63+
'right'
6164
)
6265
).toBeNull()
6366
})

app/src/calibration/pipette-offset/selectors.js

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,28 @@ export const getPipetteOffsetCalibrations: (
2020
export const getCalibrationForPipette: (
2121
state: State,
2222
robotName: string,
23-
pipetteSerial: string
24-
) => PipetteOffsetCalibration | null = (state, robotName, pipetteSerial) => {
23+
pipetteSerial: string,
24+
mount: string | null
25+
) => PipetteOffsetCalibration | null = (
26+
state,
27+
robotName,
28+
pipetteSerial,
29+
mount
30+
) => {
2531
const allCalibrations = getPipetteOffsetCalibrations(state, robotName)
26-
return filterCalibrationForPipette(allCalibrations, pipetteSerial)
32+
return filterCalibrationForPipette(allCalibrations, pipetteSerial, mount)
2733
}
2834

2935
export const filterCalibrationForPipette: (
3036
calibrations: Array<PipetteOffsetCalibration>,
31-
pipetteSerial: string
32-
) => PipetteOffsetCalibration | null = (calibrations, pipetteSerial) => {
33-
return head(calibrations.filter(cal => cal.pipette === pipetteSerial)) || null
37+
pipetteSerial: string,
38+
mount: string | null
39+
) => PipetteOffsetCalibration | null = (calibrations, pipetteSerial, mount) => {
40+
return (
41+
head(
42+
calibrations.filter(
43+
cal => cal.pipette === pipetteSerial && cal.mount === mount
44+
)
45+
) || null
46+
)
3447
}

app/src/components/ChangePipette/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export function ChangePipette(props: Props): React.Node {
8383
const actualPipette = attachedPipette?.modelSpecs || null
8484
const actualPipetteOffset = useSelector((state: State) =>
8585
attachedPipette?.id
86-
? getCalibrationForPipette(state, robotName, attachedPipette.id)
86+
? getCalibrationForPipette(state, robotName, attachedPipette.id, mount)
8787
: null
8888
)
8989

app/src/components/InstrumentSettings/PipetteCalibrationInfo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function PipetteCalibrationInfo(props: Props): React.Node {
9393
const [pocTargetProps, pocTooltipProps] = useHoverTooltip()
9494
const pipetteOffsetCalibration = useSelector((state: State) =>
9595
serialNumber
96-
? getCalibrationForPipette(state, robotName, serialNumber)
96+
? getCalibrationForPipette(state, robotName, serialNumber, mount)
9797
: null
9898
)
9999
const tipLengthCalibration = useSelector((state: State) =>

app/src/components/InstrumentSettings/__tests__/PipetteInfo.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ const mockGetCustomLabwareDefinitions: JestMockFn<
3434
> = getCustomLabwareDefinitions
3535

3636
const mockGetCalibrationForPipette: JestMockFn<
37-
[State, string, string],
38-
$Call<typeof getCalibrationForPipette, State, string, string>
37+
[State, string, string, string],
38+
$Call<typeof getCalibrationForPipette, State, string, string, string>
3939
> = getCalibrationForPipette
4040

4141
const mockGetTipLengthForPipetteAndTiprack: JestMockFn<

app/src/pages/Calibrate/Pipettes.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ export function Pipettes(props: Props): React.Node {
105105
const convertRobotNameToString = robotName || 'unknown'
106106
const pipetteOffsetCalibration = useSelector((state: State) =>
107107
serialNumber
108-
? getCalibrationForPipette(state, convertRobotNameToString, serialNumber)
108+
? getCalibrationForPipette(
109+
state,
110+
convertRobotNameToString,
111+
serialNumber,
112+
currentMount
113+
)
109114
: null
110115
)
111116

app/src/pipettes/selectors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ export const getAttachedPipetteCalibrations: (
9090
(attached, calibrations, tipLengths) => {
9191
const offsets = {
9292
left: attached.left
93-
? filterCalibrationForPipette(calibrations, attached.left.id)
93+
? filterCalibrationForPipette(calibrations, attached.left.id, 'left')
9494
: null,
9595
right: attached.right
96-
? filterCalibrationForPipette(calibrations, attached.right.id)
96+
? filterCalibrationForPipette(calibrations, attached.right.id, 'right')
9797
: null,
9898
}
9999
return {

0 commit comments

Comments
 (0)