Skip to content

Commit

Permalink
Function was moved state no longer available
Browse files Browse the repository at this point in the history
Moved logic to DatacCollection and Characterisaiton where its used.
  • Loading branch information
marcus-oscarsson committed Oct 10, 2023
1 parent 7c40a4e commit da38a21
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
10 changes: 9 additions & 1 deletion ui/src/components/Tasks/Characterisation.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,14 @@ export default connect((state) => {

const { type } = state.taskForm.taskData;
const { limits } = state.taskForm.defaultParameters[type.toLowerCase()];
const parameters = state.taskForm.taskData.parameters;

if (parseFloat(parameters.osc_range) === 0) {
parameters.osc_range =
state.taskForm.defaultParameters[
type.toLowerCase()
].acq_parameters.osc_range;
}

return {
path: `${state.login.rootPath}/${subdir}`,
Expand All @@ -504,7 +512,7 @@ export default connect((state) => {
use_min_dose: selector(state, 'use_min_dose'),
use_min_time: selector(state, 'use_min_time'),
initialValues: {
...state.taskForm.taskData.parameters,
...parameters,
beam_size: state.sampleview.currentAperture,
resolution:
state.taskForm.sampleIds.constructor !== Array
Expand Down
10 changes: 9 additions & 1 deletion ui/src/components/Tasks/DataCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,22 @@ export default connect((state) => {

const { type } = state.taskForm.taskData;
const { limits } = state.taskForm.defaultParameters[type.toLowerCase()];
const parameters = state.taskForm.taskData.parameters;

if (parseFloat(parameters.osc_range) === 0) {
parameters.osc_range =
state.taskForm.defaultParameters[
type.toLowerCase()
].acq_parameters.osc_range;
}

return {
path: `${state.login.rootPath}/${subdir}`,
filename: fname,
acqParametersLimits: limits,
beamline: state.beamline,
initialValues: {
...state.taskForm.taskData.parameters,
...parameters,
beam_size: state.sampleview.currentAperture,
resolution:
state.taskForm.sampleIds.constructor !== Array
Expand Down
7 changes: 0 additions & 7 deletions ui/src/components/Tasks/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ export function getLastUsedParameters(type, newParams) {
const parameters =
lastParameters === null ? newParams : JSON.parse(lastParameters);

if (parseFloat(parameters.osc_range) === 0) {
parameters.osc_range =
state.taskForm.defaultParameters[
type.toLowerCase()
].acq_parameters.osc_range;
}

return parameters;
}

Expand Down

0 comments on commit da38a21

Please sign in to comment.