Skip to content

Commit

Permalink
fix(app): fix temperature module wait for temp text (#12738)
Browse files Browse the repository at this point in the history
The wait for target temperature command for the temperature module improperly interpolates a
temperature value, despite the fact that only the target temperature previously set will be awaited

Closes RQA-749
  • Loading branch information
b-cooper authored Aug 23, 2023
1 parent d20f59c commit 7ee87e8
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 13 deletions.
12 changes: 7 additions & 5 deletions app/src/assets/localization/en/protocol_command_text.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"deactivating_hs_heater": "Deactivating heater",
"deactivating_tc_block": "Deactivating Thermocycler block",
"deactivating_tc_lid": "Deactivating Thermocycler lid",
"degrees_c": "{{temp}}°C",
"disengaging_magnetic_module": "Disengaging Magnetic Module",
"dispense": "Dispensing {{volume}} µL into well {{well_name}} of {{labware}} in {{labware_location}} at {{flow_rate}} µL/sec",
"drop_tip": "Dropping tip in {{well_name}} of {{labware}}",
Expand All @@ -35,11 +36,12 @@
"pickup_tip": "Picking up tip from {{well_name}} of {{labware}} in {{labware_location}}",
"save_position": "Saving position",
"set_and_await_hs_shake": "Setting Heater-Shaker to shake at {{rpm}} rpm and waiting until reached",
"setting_hs_temp": "Setting Target Temperature of Heater-Shaker to {{temp}}°C",
"setting_temperature_module_temp": "Setting Temperature Module to {{temp}}°C (rounded to nearest integer)",
"setting_thermocycler_block_temp": "Setting Thermocycler block temperature to {{temp}}°C with hold time of {{hold_time_seconds}} seconds after target reached",
"setting_thermocycler_lid_temp": "Setting Thermocycler lid temperature to {{temp}}°C",
"setting_hs_temp": "Setting Target Temperature of Heater-Shaker to {{temp}}",
"setting_temperature_module_temp": "Setting Temperature Module to {{temp}} (rounded to nearest integer)",
"setting_thermocycler_block_temp": "Setting Thermocycler block temperature to {{temp}} with hold time of {{hold_time_seconds}} seconds after target reached",
"setting_thermocycler_lid_temp": "Setting Thermocycler lid temperature to {{temp}}",
"slot": "Slot {{slot_name}}",
"target_temperature": "target temperature",
"tc_awaiting_for_duration": "Waiting for Thermocycler profile to complete",
"tc_run_profile_steps": "temperature: {{celsius}}°C, seconds: {{seconds}}",
"tc_starting_profile": "Thermocycler starting {{repetitions}} repetitions of cycle composed of the following steps:",
Expand All @@ -50,5 +52,5 @@
"waiting_for_hs_to_reach": "Waiting for Heater-Shaker to reach target temperature",
"waiting_for_tc_block_to_reach": "Waiting for Thermocycler block to reach target temperature and holding for specified time",
"waiting_for_tc_lid_to_reach": "Waiting for Thermocycler lid to reach target temperature",
"waiting_to_reach_temp_module": "Waiting for Temperature Module to reach {{temp}}°C (rounded to nearest integer)"
"waiting_to_reach_temp_module": "Waiting for Temperature Module to reach {{temp}}"
}
5 changes: 4 additions & 1 deletion app/src/organisms/CommandText/TemperatureCommandText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export const TemperatureCommandText = ({
const { t } = useTranslation('protocol_command_text')

return t(T_KEYS_BY_COMMAND_TYPE[command.commandType], {
temp: command.params.celsius,
temp:
command.params?.celsius != null
? t('degrees_c', { temp: command.params.celsius })
: t('target_temperature'),
hold_time_seconds:
'holdTimeSeconds' in command.params
? command.params.holdTimeSeconds ?? '0'
Expand Down
28 changes: 24 additions & 4 deletions app/src/organisms/CommandText/__tests__/CommandText.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ describe('CommandText', () => {
)[0]
getByText('Setting Temperature Module to 20°C (rounded to nearest integer)')
})
it('renders correct text for temperatureModule/waitForTemperature', () => {
it('renders correct text for temperatureModule/waitForTemperature with target temp', () => {
const mockTemp = 20
const { getByText } = renderWithProviders(
<CommandText
Expand All @@ -343,9 +343,29 @@ describe('CommandText', () => {
i18nInstance: i18n,
}
)[0]
getByText(
'Waiting for Temperature Module to reach 20°C (rounded to nearest integer)'
)
getByText('Waiting for Temperature Module to reach 20°C')
})
it('renders correct text for temperatureModule/waitForTemperature with no specified temp', () => {
const { getByText } = renderWithProviders(
<CommandText
command={{
commandType: 'temperatureModule/waitForTemperature',
params: { moduleId: 'abc123' },
id: 'def456',
result: {},
status: 'queued',
error: null,
createdAt: 'fake_timestamp',
startedAt: null,
completedAt: null,
}}
robotSideAnalysis={mockRobotSideAnalysis}
/>,
{
i18nInstance: i18n,
}
)[0]
getByText('Waiting for Temperature Module to reach target temperature')
})
it('renders correct text for thermocycler/setTargetBlockTemperature', () => {
const mockTemp = 20
Expand Down
7 changes: 6 additions & 1 deletion shared-data/protocol/types/schemaV7/command/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,15 @@ export interface TemperatureModuleDeactivateRunTimeCommand
TemperatureModuleDeactivateCreateCommand {
result?: any
}
export interface TemperatureModuleAwaitTemperatureParams {
// same params as TemperatureParams except celsius is optional
moduleId: string
celsius?: number
}
export interface TemperatureModuleAwaitTemperatureCreateCommand
extends CommonCommandCreateInfo {
commandType: 'temperatureModule/waitForTemperature'
params: TemperatureParams
params: TemperatureModuleAwaitTemperatureParams
}
export interface TemperatureModuleAwaitTemperatureRunTimeCommand
extends CommonCommandRunTimeInfo,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import {
TEMPERATURE_AT_TARGET,
} from '../constants'
import type {
TemperatureModuleAwaitTemperatureParams,
TemperatureParams,
ModuleOnlyParams,
} from '@opentrons/shared-data/protocol/types/schemaV6/command/module'
} from '@opentrons/shared-data/protocol/types/schemaV7/command/module'
import type {
InvariantContext,
RobotStateAndWarnings,
Expand Down Expand Up @@ -39,7 +40,7 @@ export function forSetTemperature(
_setTemperatureAndStatus(moduleState, celsius, TEMPERATURE_APPROACHING_TARGET)
}
export function forAwaitTemperature(
params: TemperatureParams,
params: TemperatureModuleAwaitTemperatureParams,
invariantContext: InvariantContext,
robotStateAndWarnings: RobotStateAndWarnings
): void {
Expand Down

0 comments on commit 7ee87e8

Please sign in to comment.