forked from CIT/Vmeda.Online
		
	
						commit
						90d3dbbe2b
					
				| @ -63,8 +63,6 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandler implements Ad | ||||
|             field.dimtitle = this.translate.instant( | ||||
|                     'addon.mod_workshop_assessment_accumulative.dimensionnumber', {$a: field.number}); | ||||
| 
 | ||||
|             const scale = parseInt(field.grade, 10) < 0 ? form.dimensionsinfo[n].scale : null; | ||||
| 
 | ||||
|             if (!form.current[n]) { | ||||
|                 form.current[n] = {}; | ||||
|             } | ||||
| @ -76,7 +74,11 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandler implements Ad | ||||
| 
 | ||||
|             form.current[n].grade = form.current[n].grade ? parseInt(form.current[n].grade, 10) : -1; | ||||
| 
 | ||||
|             promises.push(this.gradesHelper.makeGradesMenu(field.grade, workshopId, defaultGrade, -1, scale).then((grades) => { | ||||
|             const gradingType = parseInt(field.grade, 10); | ||||
|             const dimension = form.dimensionsinfo.find((dimension) => dimension.id == field.dimensionid); | ||||
|             const scale = dimension && gradingType < 0 ? dimension.scale : null; | ||||
| 
 | ||||
|             promises.push(this.gradesHelper.makeGradesMenu(gradingType, undefined, defaultGrade, -1, scale).then((grades) => { | ||||
|                 field.grades = grades; | ||||
|                 originalValues[n].grade = form.current[n].grade; | ||||
|             })); | ||||
|  | ||||
| @ -127,7 +127,7 @@ | ||||
|                 <ion-item text-wrap *ngIf="!assessments || !assessments.length"> | ||||
|                     <p>{{ 'addon.mod_workshop.assignedassessmentsnone' | translate }}</p> | ||||
|                 </ion-item> | ||||
|                 <ng-container *ngFor="let assessment of assessments"> | ||||
|                 <ng-container *ngFor="let assessment of (assessments || [])"> | ||||
|                     <addon-mod-workshop-submission [submission]="assessment.submission" [assessment]="assessment" [courseId]="workshop.course" [module]="module" [workshop]="workshop" [access]="access" summary="true"></addon-mod-workshop-submission> | ||||
|                 </ng-container> | ||||
|             </ion-card > | ||||
|  | ||||
| @ -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 { | ||||
|  | ||||
| @ -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 = { | ||||
|  | ||||
| @ -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<any>} Promise resolved with the module's grade info. | ||||
|  | ||||
| @ -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<any[]>}         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<any[]> { | ||||
|         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([]); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user