Skip to content

Commit 77bc720

Browse files
authored
refactor(app): add RTP properties to protocol run event analytics (#14836)
* refactor(app): add RTP properties to protocol run event analytics
1 parent 5f85719 commit 77bc720

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

app/src/organisms/Devices/hooks/__tests__/useProtocolRunAnalyticsData.test.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ const MODULES = {
3737
module1: { model: 'module1' },
3838
module2: { model: 'module2' },
3939
}
40+
const RUNTIME_PARAMETERS = [
41+
{
42+
displayName: 'test param',
43+
variableName: 'test_param',
44+
description: 'Mock boolean parameter',
45+
type: 'bool',
46+
default: true,
47+
value: true,
48+
},
49+
]
4050
const FORMATTED_MODULES = 'module1,module2'
4151
const STORED_PROTOCOL_ANALYSIS = {
4252
config: { protocolType: 'json', schemaVersion: 1.11 },
@@ -49,11 +59,13 @@ const STORED_PROTOCOL_ANALYSIS = {
4959
robotType: 'OT-2 Standard',
5060
pipettes: PIPETTES,
5161
modules: MODULES,
62+
runTimeParameters: RUNTIME_PARAMETERS,
5263
}
5364
const ROBOT_PROTOCOL_ANALYSIS = {
5465
robotType: 'OT-2 Standard',
5566
pipettes: PIPETTES,
5667
modules: MODULES,
68+
runTimeParameters: RUNTIME_PARAMETERS,
5769
}
5870

5971
describe('useProtocolAnalysisErrors hook', () => {
@@ -126,6 +138,8 @@ describe('useProtocolAnalysisErrors hook', () => {
126138
protocolAppName: 'Python API',
127139
protocolAppVersion: 2.3,
128140
protocolAuthor: 'hashedString',
141+
protocolHasRunTimeParameterCustomValues: false,
142+
protocolHasRunTimeParameters: true,
129143
protocolName: 'robot protocol',
130144
protocolSource: 'robot protocol source',
131145
protocolText: 'hashedString',
@@ -156,6 +170,8 @@ describe('useProtocolAnalysisErrors hook', () => {
156170
protocolAppVersion: '1.1',
157171
protocolAuthor: 'hashedString',
158172
protocolName: 'stored protocol',
173+
protocolHasRunTimeParameterCustomValues: false,
174+
protocolHasRunTimeParameters: true,
159175
protocolSource: 'stored protocol source',
160176
protocolText: 'hashedString',
161177
protocolType: 'json',

app/src/organisms/Devices/hooks/useProtocolRunAnalyticsData.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,14 @@ export const parseProtocolRunAnalyticsData = (
5151
.join(','),
5252
protocolAuthor: protocolAuthor !== '' ? protocolAuthor : '',
5353
protocolText: protocolText !== '' ? protocolText : '',
54+
protocolHasRunTimeParameters:
55+
protocolAnalysis?.runTimeParameters != null
56+
? protocolAnalysis?.runTimeParameters?.length > 0
57+
: false,
58+
protocolHasRunTimeParameterCustomValues:
59+
protocolAnalysis?.runTimeParameters?.some(
60+
param => param.value !== param.default
61+
) ?? false,
5462
robotType:
5563
protocolAnalysis?.robotType != null
5664
? protocolAnalysis?.robotType

0 commit comments

Comments
 (0)