Merge pull request #2623 from dpalou/MOBILE-3523
MOBILE-3523 qtype_calculated: Fallback if unitsleft is nullmain
commit
97511e3463
|
@ -191,7 +191,7 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler {
|
||||||
let unitsLeft = false;
|
let unitsLeft = false;
|
||||||
let match = null;
|
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.
|
// We don't know if units should be before or after so we check both.
|
||||||
match = answer.match(new RegExp('^' + regexString));
|
match = answer.match(new RegExp('^' + regexString));
|
||||||
if (!match) {
|
if (!match) {
|
||||||
|
|
|
@ -108,7 +108,7 @@ export class CoreQuestionBaseComponent {
|
||||||
this.question.select = selectModel;
|
this.question.select = selectModel;
|
||||||
|
|
||||||
// Check which one should be displayed first: the select or the input.
|
// 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';
|
this.question.selectFirst = this.question.settings.unitsleft == '1';
|
||||||
} else {
|
} else {
|
||||||
const input = questionEl.querySelector('input[type="text"][name*=answer]');
|
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.
|
// 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';
|
this.question.optionsFirst = this.question.settings.unitsleft == '1';
|
||||||
} else {
|
} else {
|
||||||
const input = questionEl.querySelector('input[type="text"][name*=answer]');
|
const input = questionEl.querySelector('input[type="text"][name*=answer]');
|
||||||
|
|
Loading…
Reference in New Issue