Skip to content

Commit 1a87eb3

Browse files
committed
MOBILE-3523 qtype_calculated: Fallback if unitsleft is null
1 parent 1be4bc0 commit 1a87eb3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/addon/qtype/calculated/providers/handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export class AddonQtypeCalculatedHandler implements CoreQuestionHandler {
191191
let unitsLeft = false;
192192
let match = null;
193193

194-
if (!question.settings) {
194+
if (!question.settings || question.settings.unitsleft === null) {
195195
// We don't know if units should be before or after so we check both.
196196
match = answer.match(new RegExp('^' + regexString));
197197
if (!match) {

src/core/question/classes/base-question-component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class CoreQuestionBaseComponent {
108108
this.question.select = selectModel;
109109

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

168168
// Check which one should be displayed first: the options or the input.
169-
if (this.question.settings) {
169+
if (this.question.settings && this.question.settings.unitsleft !== null) {
170170
this.question.optionsFirst = this.question.settings.unitsleft == '1';
171171
} else {
172172
const input = questionEl.querySelector('input[type="text"][name*=answer]');

0 commit comments

Comments
 (0)