forked from CIT/Vmeda.Online
		
	Merge pull request #1782 from crazyserver/MOBILE-2876
MOBILE-2876 workshop: Fix check more dimensions than given
This commit is contained in:
		
						commit
						d129c23d54
					
				| @ -120,6 +120,7 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandler implements Ad | ||||
|         let hasErrors = false; | ||||
| 
 | ||||
|         form.fields.forEach((field, idx) => { | ||||
|             if (idx < form.dimenssionscount) { | ||||
|                 const grade = parseInt(currentValues[idx].grade, 10); | ||||
|                 if (!isNaN(grade) && grade >= 0) { | ||||
|                     data['grade__idx_' + idx] = grade; | ||||
| @ -135,6 +136,7 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandler implements Ad | ||||
|                 data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; | ||||
|                 data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); | ||||
|                 data['weight__idx_' + idx] = parseInt(field.weight, 10) ||  0; | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         if (hasErrors) { | ||||
|  | ||||
| @ -102,6 +102,7 @@ export class AddonModWorkshopAssessmentStrategyCommentsHandler implements AddonW | ||||
|         let hasErrors = false; | ||||
| 
 | ||||
|         form.fields.forEach((field, idx) => { | ||||
|             if (idx < form.dimenssionscount) { | ||||
|                 if (currentValues[idx].peercomment) { | ||||
|                     data['peercomment__idx_' + idx] = currentValues[idx].peercomment; | ||||
|                 } else { | ||||
| @ -111,6 +112,7 @@ export class AddonModWorkshopAssessmentStrategyCommentsHandler implements AddonW | ||||
| 
 | ||||
|                 data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; | ||||
|                 data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         if (hasErrors) { | ||||
|  | ||||
| @ -106,8 +106,9 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandler implements Addon | ||||
|         let hasErrors = false; | ||||
| 
 | ||||
|         form.fields.forEach((field, idx) => { | ||||
|             if (idx < form.dimenssionscount) { | ||||
|                 const grade = parseInt(currentValues[idx].grade); | ||||
|             if (!isNaN(grade) && grade >= 0) { | ||||
|                 if (!isNaN(grade) && (grade == 1 || grade == -1)) { | ||||
|                     data['grade__idx_' + idx] = grade; | ||||
|                 } else { | ||||
|                     errors['grade_' + idx] = this.translate.instant('core.required'); | ||||
| @ -121,6 +122,7 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandler implements Addon | ||||
|                 data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; | ||||
|                 data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); | ||||
|                 data['weight__idx_' + idx] = parseInt(field.weight, 10) ||  0; | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         if (hasErrors) { | ||||
|  | ||||
| @ -102,6 +102,7 @@ export class AddonModWorkshopAssessmentStrategyRubricHandler implements AddonWor | ||||
|         let hasErrors = false; | ||||
| 
 | ||||
|         form.fields.forEach((field, idx) => { | ||||
|             if (idx < form.dimenssionscount) { | ||||
|                 const id = parseInt(currentValues[idx].chosenlevelid, 10); | ||||
|                 if (!isNaN(id) && id >= 0) { | ||||
|                     data['chosenlevelid__idx_' + idx] = id; | ||||
| @ -112,6 +113,7 @@ export class AddonModWorkshopAssessmentStrategyRubricHandler implements AddonWor | ||||
| 
 | ||||
|                 data['gradeid__idx_' + idx] = parseInt(form.current[idx].gradeid, 10) || 0; | ||||
|                 data['dimensionid__idx_' + idx] = parseInt(field.dimensionid, 10); | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         if (hasErrors) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user