Skip to content

Commit

Permalink
feat(app): allow p1000 gen2 to fallback to specced p1000 gen1 (#4316)
Browse files Browse the repository at this point in the history
When a robot has an attached P1000 Single GEN2, the and the uploaded protocol has a P1000 Single
GEN1 attached, the app should accept the newer actual pipette as an inexact match. This mirrors the
case of P300 GEN2 -> P300 GEN1 and P20 GEN2 -> P10 GEN1.

re #3598
  • Loading branch information
b-cooper authored and sfoster1 committed Oct 30, 2019
1 parent 24841ab commit 0e33f65
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
29 changes: 11 additions & 18 deletions app/src/components/FileInfo/useInstrumentMountInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,12 @@ type InstrumentMountInfo = {|
|}
const { PIPETTE_MOUNTS } = robotConstants

function pipettesAreInexactMatch(protocolInstrName, actualInstrName) {
switch (protocolInstrName) {
case 'p300_single':
case 'p300_single_gen1':
return actualInstrName === 'p300_single_gen2'
case 'p10_single':
case 'p10_single_gen1':
return actualInstrName === 'p20_single_gen2'
default:
return false
}
function pipettesAreInexactMatch(
protocolInstrName: ?string,
actualModelSpecs: ?PipetteModelSpecs
) {
const { backCompatNames } = actualModelSpecs || {}
return backCompatNames && backCompatNames.includes(protocolInstrName)
}

function useInstrumentMountInfo(
Expand All @@ -59,23 +54,21 @@ function useInstrumentMountInfo(
const protocolInstrument = protocolInstruments.find(i => i.mount === mount)
const actualInstrument = actualInstruments[mount]

const actualPipetteConfig = getPipetteModelSpecs(
actualInstrument?.model || ''
)
const actualModelSpecs = getPipetteModelSpecs(actualInstrument?.model || '')
const requestedDisplayName = protocolInstrument?.requestedAs
? getPipetteNameSpecs(protocolInstrument?.requestedAs)?.displayName
: protocolInstrument?.modelSpecs?.displayName

const protocolInstrName =
protocolInstrument?.requestedAs || protocolInstrument?.modelSpecs?.name
const actualInstrName = actualPipetteConfig?.name
const actualInstrName = actualModelSpecs?.name

const perfectMatch = protocolInstrName === actualInstrName

let compatibility: PipetteCompatibility = 'incompatible'
if (perfectMatch || isEmpty(protocolInstrument)) {
compatibility = 'match'
} else if (pipettesAreInexactMatch(protocolInstrName, actualInstrName)) {
} else if (pipettesAreInexactMatch(protocolInstrName, actualModelSpecs)) {
compatibility = 'inexact_match'
}

Expand All @@ -88,8 +81,8 @@ function useInstrumentMountInfo(
},
actual: {
...actualInstrument,
modelSpecs: actualPipetteConfig,
displayName: actualPipetteConfig?.displayName || 'N/A',
modelSpecs: actualModelSpecs,
displayName: actualModelSpecs?.displayName || 'N/A',
},
compatibility,
},
Expand Down
1 change: 1 addition & 0 deletions shared-data/js/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,5 +265,6 @@ export type PipetteNameSpecs = {|
export type PipetteModelSpecs = {
...PipetteNameSpecs,
model: string,
backCompatNames?: Array<string>,
tipLength: { value: number },
}

0 comments on commit 0e33f65

Please sign in to comment.