diff --git a/scripts/langindex.json b/scripts/langindex.json index da66b6940..2bbbdb083 100644 --- a/scripts/langindex.json +++ b/scripts/langindex.json @@ -145,6 +145,7 @@ "addon.coursecompletion.criteriarequiredany": "completion", "addon.coursecompletion.inprogress": "completion", "addon.coursecompletion.manualselfcompletion": "completion", + "addon.coursecompletion.nottracked": "completion", "addon.coursecompletion.notyetstarted": "completion", "addon.coursecompletion.pending": "completion", "addon.coursecompletion.required": "moodle", diff --git a/src/addon/coursecompletion/components/report/addon-course-completion-report.html b/src/addon/coursecompletion/components/report/addon-course-completion-report.html index b4a6a25eb..2b4b92070 100644 --- a/src/addon/coursecompletion/components/report/addon-course-completion-report.html +++ b/src/addon/coursecompletion/components/report/addon-course-completion-report.html @@ -3,7 +3,7 @@ - + {{ 'addon.coursecompletion.status' | translate }} {{ completion.statusText | translate }} @@ -14,7 +14,7 @@ {{ 'addon.coursecompletion.criteriarequiredany' | translate }} - + {{ 'addon.coursecompletion.requiredcriteria' | translate }} @@ -41,11 +41,16 @@ - + {{ 'addon.coursecompletion.manualselfcompletion' | translate }} {{ 'addon.coursecompletion.completecourse' | translate }} + + + + {{ 'addon.coursecompletion.nottracked' | translate }} + diff --git a/src/addon/coursecompletion/components/report/report.ts b/src/addon/coursecompletion/components/report/report.ts index 69583770f..50d12cf90 100644 --- a/src/addon/coursecompletion/components/report/report.ts +++ b/src/addon/coursecompletion/components/report/report.ts @@ -31,6 +31,7 @@ export class AddonCourseCompletionReportComponent implements OnInit { completionLoaded = false; completion: any; showSelfComplete: boolean; + tracked = true; // Whether completion is tracked. constructor( private sitesProvider: CoreSitesProvider, @@ -62,8 +63,14 @@ export class AddonCourseCompletionReportComponent implements OnInit { this.completion = completion; this.showSelfComplete = this.courseCompletionProvider.canMarkSelfCompleted(this.userId, completion); - }).catch((message) => { - this.domUtils.showErrorModalDefault(message, 'addon.coursecompletion.couldnotloadreport', true); + this.tracked = true; + }).catch((error) => { + if (error && error.errorcode == 'notenroled') { + // Not enrolled error, probably a teacher. + this.tracked = false; + } else { + this.domUtils.showErrorModalDefault(error, 'addon.coursecompletion.couldnotloadreport', true); + } }); } diff --git a/src/addon/coursecompletion/lang/en.json b/src/addon/coursecompletion/lang/en.json index 7607702c6..81ef0272e 100644 --- a/src/addon/coursecompletion/lang/en.json +++ b/src/addon/coursecompletion/lang/en.json @@ -12,6 +12,7 @@ "criteriarequiredany": "Any criteria below are required", "inprogress": "In progress", "manualselfcompletion": "Manual self completion", + "nottracked": "You are currently not being tracked by completion in this course", "notyetstarted": "Not yet started", "pending": "Pending", "required": "Required", diff --git a/src/assets/lang/en.json b/src/assets/lang/en.json index b6072b623..9f14d682a 100644 --- a/src/assets/lang/en.json +++ b/src/assets/lang/en.json @@ -145,6 +145,7 @@ "addon.coursecompletion.criteriarequiredany": "Any criteria below are required", "addon.coursecompletion.inprogress": "In progress", "addon.coursecompletion.manualselfcompletion": "Manual self completion", + "addon.coursecompletion.nottracked": "You are currently not being tracked by completion in this course", "addon.coursecompletion.notyetstarted": "Not yet started", "addon.coursecompletion.pending": "Pending", "addon.coursecompletion.required": "Required",
{{ completion.statusText | translate }}
{{ 'addon.coursecompletion.criteriarequiredany' | translate }}