Skip to content

Commit

Permalink
feat(app): mark protocol anlayses as stale if they lack RTP (#14763)
Browse files Browse the repository at this point in the history
  • Loading branch information
ncdiehl11 authored and Carlos-fernandez committed May 20, 2024
1 parent 1a45766 commit 37beafc
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3936,5 +3936,6 @@
"description": "",
"displayColor": "#b925ff"
}
]
],
"runTimeParameters": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ describe('write failed analysis', () => {
modules: [],
pipettes: [],
liquids: [],
runTimeParameters: [],
})
})
})
Expand Down
1 change: 1 addition & 0 deletions app-shell/src/protocol-analysis/writeFailedAnalysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function createFailedAnalysis(
pipettes: [],
modules: [],
liquids: [],
runTimeParameters: [],
// TODO(mc, 2022-05-04): this field does not make sense for an
// analysis that was unable to complete, but is required by
// ProtocolAnalysisOutput
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ describe('protocol storage directory utilities', () => {
pipettes: [],
modules: [],
labware: [],
runTimeParameters: [],
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const modifiedStoredProtocolData = {
commands: storedProtocolData?.mostRecentAnalysis?.commands,
liquids: storedProtocolData?.mostRecentAnalysis?.liquids,
errors: storedProtocolData?.mostRecentAnalysis?.errors,
runTimeParameters:
storedProtocolData?.mostRecentAnalysis?.runTimeParameters,
},
}

Expand Down
3 changes: 3 additions & 0 deletions app/src/organisms/ProtocolsLanding/__tests__/hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ const mockStoredProtocolData = [
displayColor: '#ff4f4f',
},
],
runTimeParameters: [],
errors: [],
} as ProtocolAnalysisOutput,
},
Expand Down Expand Up @@ -183,6 +184,7 @@ const mockStoredProtocolData = [
displayColor: '#ff4f4f',
},
],
runTimeParameters: [],
errors: [],
} as ProtocolAnalysisOutput,
},
Expand Down Expand Up @@ -273,6 +275,7 @@ const mockStoredProtocolData = [
displayColor: '#ff4f4f',
},
],
runTimeParameters: [],
errors: [],
} as ProtocolAnalysisOutput,
},
Expand Down
36 changes: 35 additions & 1 deletion app/src/organisms/ProtocolsLanding/__tests__/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { describe, it, expect } from 'vitest'
import { getisFlexProtocol, getRobotTypeDisplayName } from '../utils'
import {
getAnalysisStatus,
getisFlexProtocol,
getRobotTypeDisplayName,
} from '../utils'
import type { ProtocolAnalysisOutput } from '@opentrons/shared-data'

const mockOT3ProtocolAnalysisOutput = {
Expand All @@ -10,6 +14,36 @@ const mockOT2ProtocolAnalysisOutput = {
robotType: 'OT-2 Standard',
} as ProtocolAnalysisOutput

describe('getAnalysisStatus', () => {
it('should return stale if no liquids in analysis', () => {
const result = getAnalysisStatus(false, {
...mockOT3ProtocolAnalysisOutput,
liquids: [],
errors: [],
})
expect(result).toBe('stale')
})

it('should return stale if no runTimeParameters in analysis', () => {
const result = getAnalysisStatus(false, {
...mockOT3ProtocolAnalysisOutput,
runTimeParameters: [],
errors: [],
})
expect(result).toBe('stale')
})

it('should return complete if liquids and runTimeParameters in analysis', () => {
const result = getAnalysisStatus(false, {
...mockOT3ProtocolAnalysisOutput,
liquids: [],
runTimeParameters: [],
errors: [],
})
expect(result).toBe('complete')
})
})

describe('getisFlexProtocol', () => {
it('should return true for protocols intended for a Flex', () => {
const result = getisFlexProtocol(mockOT3ProtocolAnalysisOutput)
Expand Down
5 changes: 4 additions & 1 deletion app/src/organisms/ProtocolsLanding/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export function getAnalysisStatus(
): AnalysisStatus {
if (isAnalyzing) {
return 'loading'
} else if (analysis != null && analysis?.liquids == null) {
} else if (
analysis != null &&
(analysis.liquids == null || analysis.runTimeParameters == null)
) {
return 'stale'
} else if (analysis != null) {
return analysis.errors.length > 0 ? 'error' : 'complete'
Expand Down
2 changes: 2 additions & 0 deletions shared-data/protocol/types/schemaV8/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
LoadedLabware,
LoadedModule,
Liquid,
RunTimeParameter,
} from '../../../js'
import type { CommandAnnotation } from '../../../commandAnnotation/types'
import type { LabwareDefinition2, RobotType } from '../../../js/types'
Expand Down Expand Up @@ -136,6 +137,7 @@ export interface ProtocolAnalysisOutput {
modules: LoadedModule[]
liquids: Liquid[]
errors: AnalysisError[]
runTimeParameters: RunTimeParameter[]
robotType?: RobotType
}

Expand Down

0 comments on commit 37beafc

Please sign in to comment.