-
+
diff --git a/src/addon/mod/workshop/pages/assessment/assessment.ts b/src/addon/mod/workshop/pages/assessment/assessment.ts
index 09b6a1e3f..6c1783e35 100644
--- a/src/addon/mod/workshop/pages/assessment/assessment.ts
+++ b/src/addon/mod/workshop/pages/assessment/assessment.ts
@@ -182,8 +182,8 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy {
if (accessData.canoverridegrades) {
defaultGrade = this.translate.instant('addon.mod_workshop.notoverridden');
- promise = this.gradesHelper.makeGradesMenu(this.workshop.gradinggrade, this.workshopId, defaultGrade,
- -1).then((grades) => {
+ promise = this.gradesHelper.makeGradesMenu(this.workshop.gradinggrade, undefined, defaultGrade, -1)
+ .then((grades) => {
this.evaluationGrades = grades;
});
} else {
diff --git a/src/addon/mod/workshop/pages/submission/submission.ts b/src/addon/mod/workshop/pages/submission/submission.ts
index 77d82fec2..1158e5df5 100644
--- a/src/addon/mod/workshop/pages/submission/submission.ts
+++ b/src/addon/mod/workshop/pages/submission/submission.ts
@@ -202,7 +202,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
this.workshop.phase < AddonModWorkshopProvider.PHASE_CLOSED && this.access.canoverridegrades;
this.ownAssessment = false;
- if (this.access.canviewallassessments || this.currentUserId == this.userId) {
+ if (this.access.canviewallassessments) {
// Get new data, different that came from stateParams.
promises.push(this.workshopProvider.getSubmissionAssessments(this.workshopId, this.submissionId)
.then((subAssessments) => {
@@ -259,8 +259,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
const defaultGrade = this.translate.instant('addon.mod_workshop.notoverridden');
- promises.push(this.gradesHelper.makeGradesMenu(this.workshop.grade, this.workshopId, defaultGrade, -1)
- .then((grades) => {
+ promises.push(this.gradesHelper.makeGradesMenu(this.workshop.grade, undefined, defaultGrade, -1).then((grades) => {
this.evaluationGrades = grades;
this.evaluate.grade = {
diff --git a/src/core/course/providers/course.ts b/src/core/course/providers/course.ts
index 1815352ea..bb4a55c5a 100644
--- a/src/core/course/providers/course.ts
+++ b/src/core/course/providers/course.ts
@@ -467,6 +467,8 @@ export class CoreCourseProvider {
/**
* Gets a module basic grade info by module ID.
*
+ * If the user does not have permision to manage the activity false is returned.
+ *
* @param {number} moduleId Module ID.
* @param {string} [siteId] Site ID. If not defined, current site.
* @return {Promise} Promise resolved with the module's grade info.
diff --git a/src/core/grades/providers/helper.ts b/src/core/grades/providers/helper.ts
index 3032f20e3..5df58c9dd 100644
--- a/src/core/grades/providers/helper.ts
+++ b/src/core/grades/providers/helper.ts
@@ -559,18 +559,19 @@ export class CoreGradesHelperProvider {
* Taken from make_grades_menu on moodlelib.php
*
* @param {number} gradingType If positive, max grade you can provide. If negative, scale Id.
- * @param {number} moduleId Module Id needed to retrieve the scale.
+ * @param {number} [moduleId] Module ID. Used to retrieve the scale items when they are not passed as parameter.
+ * If the user does not have permision to manage the activity an empty list is returned.
* @param {string} [defaultLabel] Element that will become default option, if not defined, it won't be added.
* @param {any} [defaultValue] Element that will become default option value. Default ''.
* @param {string} [scale] Scale csv list String. If not provided, it will take it from the module grade info.
* @return {Promise} Array with objects with value and label to create a propper HTML select.
*/
- makeGradesMenu(gradingType: number, moduleId: number, defaultLabel: string = '', defaultValue: any = '', scale?: string):
+ makeGradesMenu(gradingType: number, moduleId?: number, defaultLabel: string = '', defaultValue: any = '', scale?: string):
Promise {
if (gradingType < 0) {
if (scale) {
return Promise.resolve(this.utils.makeMenuFromList(scale, defaultLabel, undefined, defaultValue));
- } else {
+ } else if (moduleId) {
return this.courseProvider.getModuleBasicGradeInfo(moduleId).then((gradeInfo) => {
if (gradeInfo.scale) {
return this.utils.makeMenuFromList(gradeInfo.scale, defaultLabel, undefined, defaultValue);
@@ -578,6 +579,8 @@ export class CoreGradesHelperProvider {
return [];
});
+ } else {
+ return Promise.resolve([]);
}
}