From b3af76705e57e9b662a54ce6525d8046a95e757f Mon Sep 17 00:00:00 2001
From: Dani Palou
Date: Mon, 9 Oct 2023 16:07:34 +0200
Subject: [PATCH 1/4] MOBILE-4362 lesson: Stop and hide lesson timer when
finish lesson
---
src/addons/mod/lesson/pages/player/player.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/addons/mod/lesson/pages/player/player.ts b/src/addons/mod/lesson/pages/player/player.ts
index 99ca572a2..668baf5ee 100644
--- a/src/addons/mod/lesson/pages/player/player.ts
+++ b/src/addons/mod/lesson/pages/player/player.ts
@@ -426,6 +426,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy, CanLeave {
this.eolData = data.data;
this.messages = this.messages.concat(data.messages);
this.processData = undefined;
+ this.endTime = undefined;
CoreEvents.trigger(CoreEvents.ACTIVITY_DATA_SENT, { module: 'lesson' });
From cc472e58f5a57c2fdb28e966a1a08cb44a7abeb9 Mon Sep 17 00:00:00 2001
From: Dani Palou
Date: Tue, 10 Oct 2023 11:17:22 +0200
Subject: [PATCH 2/4] MOBILE-4362 lesson: Display 'Correct response' as badge
---
src/addons/mod/lesson/pages/user-retake/user-retake.html | 7 +++++--
src/addons/mod/lesson/pages/user-retake/user-retake.scss | 6 ++++++
src/addons/mod/lesson/services/lesson-helper.ts | 8 ++++++--
3 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/addons/mod/lesson/pages/user-retake/user-retake.html b/src/addons/mod/lesson/pages/user-retake/user-retake.html
index c11ce5186..a787489d8 100644
--- a/src/addons/mod/lesson/pages/user-retake/user-retake.html
+++ b/src/addons/mod/lesson/pages/user-retake/user-retake.html
@@ -128,7 +128,7 @@
-
+
@@ -138,12 +138,15 @@
[courseId]="courseId">
-
+
+
+ {{ answer[0].successBadge }}
+
diff --git a/src/addons/mod/lesson/pages/user-retake/user-retake.scss b/src/addons/mod/lesson/pages/user-retake/user-retake.scss
index 8e5d088c2..88e4e2989 100644
--- a/src/addons/mod/lesson/pages/user-retake/user-retake.scss
+++ b/src/addons/mod/lesson/pages/user-retake/user-retake.scss
@@ -1,3 +1,5 @@
+@import "~theme/globals";
+
:host {
.button-disabled {
opacity: 0.4;
@@ -14,4 +16,8 @@
.item-interactive-disabled ion-label {
opacity: 0.5;
}
+
+ .addon-mod_lesson-answer-success {
+ @include margin-horizontal(4px, null);
+ }
}
diff --git a/src/addons/mod/lesson/services/lesson-helper.ts b/src/addons/mod/lesson/services/lesson-helper.ts
index 6e5c00106..18b3276c5 100644
--- a/src/addons/mod/lesson/services/lesson-helper.ts
+++ b/src/addons/mod/lesson/services/lesson-helper.ts
@@ -461,25 +461,28 @@ export class AddonModLessonHelperProvider {
const element = CoreDomUtils.convertToElement(html);
// Check if it has a checkbox.
- let input = element.querySelector('input[type="checkbox"][name*="answer"]');
+ let input = element.querySelector('input[type="checkbox"][name*="answer"]');
if (input) {
// Truefalse or multichoice.
+ const successBadge = element.querySelector('.badge.badge-success');
const data: AddonModLessonCheckboxAnswerData = {
isCheckbox: true,
checked: !!input.checked,
name: input.name,
highlight: !!element.querySelector('.highlight'),
content: '',
+ successBadge: successBadge?.innerText,
};
input.remove();
+ successBadge?.remove();
data.content = element.innerHTML.trim();
return data;
}
// Check if it has an input text or number.
- input = element.querySelector('input[type="number"],input[type="text"]');
+ input = element.querySelector('input[type="number"],input[type="text"]');
if (input) {
// Short answer or numeric.
return {
@@ -700,6 +703,7 @@ export type AddonModLessonCheckboxAnswerData = {
name: string;
highlight: boolean;
content: string;
+ successBadge?: string;
};
/**
From 23b0b9afc7511c4bbeb15f5488f9a9f14ddf0d9a Mon Sep 17 00:00:00 2001
From: Dani Palou
Date: Tue, 10 Oct 2023 15:17:40 +0200
Subject: [PATCH 3/4] MOBILE-4069 behat: Fix SCORM tests in old LMS versions
---
src/addons/mod/scorm/tests/behat/attempts_and_grading.feature | 1 +
src/addons/mod/scorm/tests/behat/availability.feature | 1 +
src/addons/mod/scorm/tests/behat/basic_usage.feature | 3 ++-
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/addons/mod/scorm/tests/behat/attempts_and_grading.feature b/src/addons/mod/scorm/tests/behat/attempts_and_grading.feature
index a97d6dc45..c7adf5180 100755
--- a/src/addons/mod/scorm/tests/behat/attempts_and_grading.feature
+++ b/src/addons/mod/scorm/tests/behat/attempts_and_grading.feature
@@ -606,6 +606,7 @@ Feature: Test attempts and grading settings of SCORM activity in app
And I press the back button in the app
Then I should find "74%" within "Grade reported" "ion-item" in the app
+ @lms_from4.1
Scenario: SCORM grade is calculated right based on 'Attempts grading' setting
Given the following "activities" exist:
| activity | name | course | idnumber | packagefilepath | maxattempt | whatgrade | grademethod | forcenewattempt |
diff --git a/src/addons/mod/scorm/tests/behat/availability.feature b/src/addons/mod/scorm/tests/behat/availability.feature
index fb459aa0a..ab9175c59 100755
--- a/src/addons/mod/scorm/tests/behat/availability.feature
+++ b/src/addons/mod/scorm/tests/behat/availability.feature
@@ -20,6 +20,7 @@ Feature: Test availability options of SCORM activity in app
| scorm | C1 | Current SCORM | mod/scorm/tests/packages/singlesco_scorm12.zip | ##yesterday## | ##tomorrow## |
| scorm | C1 | Future SCORM | mod/scorm/tests/packages/singlesco_scorm12.zip | ##tomorrow## | ##+2 days## |
+ @lms_from4.1
Scenario: Only open SCORMs can be played
Given I entered the course "Course 1" as "student1" in the app
When I press "Past SCORM" in the app
diff --git a/src/addons/mod/scorm/tests/behat/basic_usage.feature b/src/addons/mod/scorm/tests/behat/basic_usage.feature
index cd833b489..44f6ba066 100755
--- a/src/addons/mod/scorm/tests/behat/basic_usage.feature
+++ b/src/addons/mod/scorm/tests/behat/basic_usage.feature
@@ -223,6 +223,7 @@ Feature: Test basic usage of SCORM activity in app
| activity | name | course | idnumber | packagefilepath |
| scorm | Basic SCORM | C1 | scorm | mod/scorm/tests/packages/RuntimeMinimumCalls_SCORM12-mini.zip |
And I entered the course "Course 1" as "student1" in the app
+ And I change viewport size to "1200x640" in the app
When I press "Basic SCORM" in the app
And I press "Enter" in the app
And I press "Disable fullscreen" in the app
@@ -230,7 +231,7 @@ Feature: Test basic usage of SCORM activity in app
When I open a browser tab with url "$WWWROOT"
And I log in as "admin"
- And I am on the "System logs report" page
+ And I navigate to "Reports > Reports > Logs" in site administration
And I set the field "id" to "Course 1"
And I set the field "user" to "Student student"
And I press "Get these logs"
From 5b9d2624a925bccaf197141b9cdbe1413af6e27e Mon Sep 17 00:00:00 2001
From: Dani Palou
Date: Tue, 10 Oct 2023 16:27:48 +0200
Subject: [PATCH 4/4] MOBILE-4362 h5p: Fix links in iframe not opened in iOS
---
src/core/services/utils/iframe.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/core/services/utils/iframe.ts b/src/core/services/utils/iframe.ts
index a35d72194..26985d187 100644
--- a/src/core/services/utils/iframe.ts
+++ b/src/core/services/utils/iframe.ts
@@ -232,7 +232,7 @@ export class CoreIframeUtilsProvider {
*/
getContentWindowAndDocument(element: CoreFrameElement): { window: Window | null; document: Document | null } {
const src = 'src' in element ? element.src : element.data;
- if (!CoreUrlUtils.isLocalFileUrl(src)) {
+ if (src !== 'about:blank' && !CoreUrlUtils.isLocalFileUrl(src)) {
// No permissions to access the iframe.
return { window: null, document: null };
}