MOBILE-3523 qtype_calculated: Fallback if unitsleft is null

main
Dani Palou 2020-11-25 15:33:02 +01:00
parent 1be4bc02d6
commit 1a87eb3094
2 changed files with 3 additions and 3 deletions

View File

@ -191,7 +191,7 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler {
let unitsLeft = false;
let match = null;
if (!question.settings) {
if (!question.settings || question.settings.unitsleft === null) {
// We don't know if units should be before or after so we check both.
match = answer.match(new RegExp('^' + regexString));
if (!match) {

View File

@ -108,7 +108,7 @@ export class CoreQuestionBaseComponent {
this.question.select = selectModel;
// Check which one should be displayed first: the select or the input.
if (this.question.settings) {
if (this.question.settings && this.question.settings.unitsleft !== null) {
this.question.selectFirst = this.question.settings.unitsleft == '1';
} else {
const input = questionEl.querySelector('input[type="text"][name*=answer]');
@ -166,7 +166,7 @@ export class CoreQuestionBaseComponent {
}
// Check which one should be displayed first: the options or the input.
if (this.question.settings) {
if (this.question.settings && this.question.settings.unitsleft !== null) {
this.question.optionsFirst = this.question.settings.unitsleft == '1';
} else {
const input = questionEl.querySelector('input[type="text"][name*=answer]');