File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/addons/qtype/numerical/services/handlers Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -216,16 +216,17 @@ export class AddonQtypeNumericalHandlerService implements CoreQuestionHandler {
216216 return Translate . instant ( 'addon.qtype_numerical.invalidnumber' ) ;
217217 }
218218
219- if ( ! question . parsedSettings ) {
220- if ( this . hasSeparateUnitField ( question ) ) {
221- return Translate . instant ( 'addon.qtype_numerical.unitnotselected' ) ;
222- }
219+ if ( this . hasSeparateUnitField ( question ) && ! this . isValidValue ( < string > answers . unit ) ) {
220+ return Translate . instant ( 'addon.qtype_numerical.unitnotselected' ) ;
221+ }
223222
224- // We cannot know if the answer should contain units or not.
223+ if ( ! question . parsedSettings ) {
224+ // We cannot check anything else without settings.
225225 return ;
226226 }
227227
228228 if ( question . parsedSettings . unitdisplay !== AddonQtypeNumericalHandlerService . UNITINPUT && unit ) {
229+ // There should be no units or be outside of the input, not valid.
229230 return Translate . instant ( 'addon.qtype_numerical.invalidnumbernounit' ) ;
230231 }
231232
You can’t perform that action at this time.
0 commit comments