MOBILE-3346 workshop: Show current user assessments when closed

main
Pau Ferrer Ocaña 2020-04-17 16:07:57 +02:00
parent 333f3f7188
commit df906f91e9
1 changed files with 25 additions and 7 deletions

View File

@ -234,16 +234,16 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
this.canDelete = !assessment;
}
assessment.userid = assessment.reviewerid;
assessment = this.workshopHelper.realGradeValue(this.workshop, assessment);
if (this.currentUserId == assessment.userid) {
this.ownAssessment = assessment;
assessment.ownAssessment = true;
}
assessment = this.parseAssessment(assessment);
this.submissionInfo.reviewedby = [assessment];
}));
} else if (this.workshop.phase == AddonModWorkshopProvider.PHASE_CLOSED && this.userId == this.currentUserId) {
this.workshopProvider.getSubmissionAssessments(this.workshopId, this.submissionId).then((assessments) => {
this.submissionInfo.reviewedby = assessments.map((assessment) => {
return this.parseAssessment(assessment);
});
});
}
if (this.canAddFeedback || this.workshop.phase == AddonModWorkshopProvider.PHASE_CLOSED) {
@ -324,6 +324,24 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
});
}
/**
* Parse assessment to be shown.
*
* @param assessment Original assessment.
* @return Parsed assessment.
*/
protected parseAssessment(assessment: any): any {
assessment.userid = assessment.reviewerid;
assessment = this.workshopHelper.realGradeValue(this.workshop, assessment);
if (this.currentUserId == assessment.userid) {
this.ownAssessment = assessment;
assessment.ownAssessment = true;
}
return assessment;
}
/**
* Force leaving the page, without checking for changes.
*/