Skip to content

Commit e958210

Browse files
committed
MOBILE-4362 workshop: Fix dimension number
It displayed 01, 11, 21 instead of 1, 2, 3
1 parent 132c597 commit e958210

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/addons/mod/workshop/services/workshop.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,23 +1100,25 @@ export class AddonModWorkshopProvider {
11001100
const args: string[] = field.name.split('_');
11011101
const name = args[0];
11021102
const idx = args[3];
1103-
const idy = args[6] || false;
1103+
const idy = args[6];
1104+
const idxNumber = parseInt(args[3], 10);
1105+
const idyNumber = parseInt(args[6], 10);
11041106

1105-
if (parseInt(idx, 10) + '' == idx) {
1107+
if (!isNaN(idxNumber)) {
11061108
if (!parsedFields[idx]) {
11071109
parsedFields[idx] = {
1108-
number: idx + 1, // eslint-disable-line id-blacklist
1110+
number: idxNumber + 1, // eslint-disable-line id-blacklist
11091111
};
11101112
}
11111113

1112-
if (idy && parseInt(idy, 10) + '' == idy) {
1114+
if (!isNaN(idyNumber)) {
11131115
if (!parsedFields[idx].fields) {
11141116
parsedFields[idx].fields = [];
11151117
}
11161118

11171119
if (!parsedFields[idx].fields[idy]) {
11181120
parsedFields[idx].fields[idy] = {
1119-
number: idy + 1, // eslint-disable-line id-blacklist
1121+
number: idyNumber + 1, // eslint-disable-line id-blacklist
11201122
};
11211123
}
11221124
parsedFields[idx].fields[idy][name] = field.value;

src/addons/mod/workshop/tests/behat/basic_usage.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Feature: Test basic usage of workshop activity in app
8282
Then I should find "Task to do" within "Assess peers" "ion-item" in the app
8383

8484
When I press "The Answer" in the app
85-
And I press "Grade for Aspect 01" in the app
85+
And I press "Grade for Aspect 1" in the app
8686
And I press "10 / 10" in the app
8787
And I press "Save" in the app
8888
Then I should find "Assessed submission" in the app

0 commit comments

Comments
 (0)