diff --git a/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/constants.js b/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/constants.js index d02705d01..9e9d43f01 100644 --- a/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/constants.js +++ b/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/constants.js @@ -34,6 +34,8 @@ const mapTypeToDescription = { [PICK_LIST]: 'Generate a sub-list by randomly choosing from a list' } +const SERIES_TYPE_OPTIONS = ['', 'arithmetic', 'geometric'] + export { STATIC_VALUE, RANDOM_NUMBER, @@ -42,6 +44,7 @@ export { RANDOM_SEQUENCE, PICK_ONE, PICK_LIST, + SERIES_TYPE_OPTIONS, typeList, mapTypeToString, mapTypeToDescription diff --git a/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/variable-list-modal.js b/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/variable-list-modal.js index a4e01f147..855a4cfef 100644 --- a/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/variable-list-modal.js +++ b/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/variable-list-modal.js @@ -6,7 +6,6 @@ import Common from 'obojobo-document-engine/src/scripts/common' import VariableProperty from './variable-property/variable-property' import NewVariable from './new-variable/new-variable' import VariableBlock from './variable-block' -import { RANDOM_NUMBER, RANDOM_LIST } from './constants' import { getParsedRange } from '../../../common/util/range-parsing' import { changeVariableToType, validateVariableValue, validateMultipleVariables } from './variable-util' diff --git a/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/variable-property/variable-value.js b/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/variable-property/variable-value.js index 9c4193629..e3922fcbe 100644 --- a/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/variable-property/variable-value.js +++ b/packages/app/obojobo-document-engine/src/scripts/oboeditor/components/variables/variable-property/variable-value.js @@ -8,7 +8,8 @@ import { RANDOM_LIST, RANDOM_SEQUENCE, PICK_ONE, - PICK_LIST + PICK_LIST, + SERIES_TYPE_OPTIONS } from '../constants' const VariableValues = props => { @@ -93,6 +94,10 @@ const VariableValues = props => { return className } + const constrainSeriesTypeOption = value => { + return SERIES_TYPE_OPTIONS.includes(value) ? value : '' + } + switch (variable.type) { case STATIC_VALUE: return ( @@ -312,7 +317,7 @@ const VariableValues = props => { + {variable.errors + && variable.errors.seriesType + && (! SERIES_TYPE_OPTIONS.includes(variable.seriesType)) ? + + Invalid option "{variable.seriesType}" + + : null}