Skip to content

Commit bc2d009

Browse files
authored
Merge pull request #4698 from crazyserver/MOBILE-4987
MOBILE-4987 completion: Show completion teachers manual rules in details
2 parents 0ffbe69 + 50d89a2 commit bc2d009

File tree

5 files changed

+22
-17
lines changed

5 files changed

+22
-17
lines changed

src/addons/mod/page/tests/behat/page_activity_completion.feature

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ Feature: View activity completion information in the Page resource
7474
| intro | A lesson learned in life |
7575
| completion | 1 |
7676
When I entered the course "Course 1" as "teacher1" in the app
77+
And I press "Completion" within "Music history" "ion-card" in the app
7778
Then I should find "Mark as done" in the app
78-
When I press "Music history" in the app
79+
When I close the popup in the app
80+
And I press "Music history" in the app
7981
Then the header should be "Music history" in the app
8082
And I should find "Mark as done" in the app
8183
But I should not be able to press "Mark as done" in the app
@@ -110,6 +112,7 @@ Feature: View activity completion information in the Page resource
110112
| completion | 1 |
111113
When I entered the course "Course 2" as "teacher1" in the app
112114
Then I should not find "Mark as done" in the app
115+
Then I should not find "Completion" in the app
113116
When I press "Music history" in the app
114117
Then the header should be "Music history" in the app
115118
And I should find "Mark as done" in the app

src/core/features/course/components/module-completion-details/module-completion-details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@if (completionDetails.length > 0) {
1+
@if (completionDetails.length > 0 || (isManual && !isTrackedUser)) {
22
<!-- Completion criterias. -->
33
<div class="ion-padding">
44
<!-- Dialog header. -->

src/core/features/course/components/module-completion/core-course-module-completion.html

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,20 @@
4141
</ion-button>
4242
}
4343
}
44+
<!-- Show a generic completion menu button for non-tracked users when either
45+
the activity uses automatic completion or the user is currently viewing
46+
the activity in the course context. -->
47+
} @else if (completion.isautomatic || inCourse) {
48+
<ion-button fill="outline" class="chip ion-text-nowrap" (click)="completionClicked($event)">
49+
{{ 'core.course.completionmenuitem' | translate }}
50+
<div class="select-icon" role="presentation" aria-hidden="true">
51+
<div class="select-icon-inner"></div>
52+
</div>
53+
</ion-button>
4454
} @else {
45-
@if (completion.isautomatic) {
46-
<ion-button fill="outline" class="chip ion-text-nowrap" (click)="completionClicked($event)">
47-
{{ 'core.course.completionmenuitem' | translate }}
48-
<div class="select-icon" role="presentation" aria-hidden="true">
49-
<div class="select-icon-inner"></div>
50-
</div>
51-
</ion-button>
52-
} @else {
53-
<ion-button fill="outline" [ariaLabel]="accessibleDescription" disabled
54-
class="completioninfo completion_incomplete chip ion-text-nowrap">
55-
{{ 'core.course.completion_manual:markdone' | translate }}
56-
</ion-button>
57-
}
55+
<ion-button fill="outline" [ariaLabel]="accessibleDescription" disabled
56+
class="completioninfo completion_incomplete chip ion-text-nowrap">
57+
{{ 'core.course.completion_manual:markdone' | translate }}
58+
</ion-button>
5859
}
5960
}

src/core/features/course/components/module-completion/module-completion.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export class CoreCourseModuleCompletionComponent
4747

4848
@Input({ transform: toBoolean }) showCompletionConditions = false; // Whether to show activity completion conditions.
4949
@Input({ transform: toBoolean }) showManualCompletion = false; // Whether to show manual completion.
50+
@Input({ transform: toBoolean }) inCourse = false; // Whether the component is displayed in a course.
5051

5152
completed = false;
5253
accessibleDescription: string | null = null;

src/core/features/course/components/module/core-course-module.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
@if (hasCompletion && !showLegacyCompletion) {
6666
<core-course-module-completion [completion]="module.completiondata" [moduleName]="module.name"
6767
[moduleId]="module.id" [showCompletionConditions]="showCompletionConditions"
68-
[showManualCompletion]="showManualCompletion"
68+
[showManualCompletion]="showManualCompletion" [inCourse]="true"
6969
(completionChanged)="completionChanged.emit($event)" />
7070
}
7171

@@ -92,7 +92,7 @@
9292

9393
<!-- Activity completion. -->
9494
@if (hasCompletion && !showLegacyCompletion) {
95-
<core-course-module-completion class="activity-extra" [completion]="module.completiondata"
95+
<core-course-module-completion class="activity-extra" [completion]="module.completiondata" [inCourse]="true"
9696
[moduleName]="module.name" [moduleId]="module.id" [showCompletionConditions]="showCompletionConditions"
9797
[showManualCompletion]="showManualCompletion" (completionChanged)="completionChanged.emit($event)" />
9898
}

0 commit comments

Comments
 (0)