MOBILE-3523 workshop: Prefetch assessments forms

main
Pau Ferrer Ocaña 2020-11-27 12:25:06 +01:00
parent 8620535d7b
commit eab3a622ba
3 changed files with 13 additions and 4 deletions

View File

@ -113,7 +113,7 @@ export class AddonModWorkshopAssessmentComponent implements OnInit {
}; };
if (!this.submission) { if (!this.submission) {
const modal = this.domUtils.showModalLoading('core.sending', true); const modal = this.domUtils.showModalLoading();
this.workshopHelper.getSubmissionById(this.workshop.id, this.assessment.submissionid, this.workshopHelper.getSubmissionById(this.workshop.id, this.assessment.submissionid,
{cmId: this.workshop.coursemodule}).then((submissionData) => { {cmId: this.workshop.coursemodule}).then((submissionData) => {

View File

@ -189,10 +189,14 @@ export class AddonModWorkshopHelperProvider {
options.siteId = options.siteId || this.sitesProvider.getCurrentSiteId(); options.siteId = options.siteId || this.sitesProvider.getCurrentSiteId();
return this.workshopProvider.getReviewerAssessments(workshopId, options).then((assessments) => { return this.workshopProvider.getReviewerAssessments(workshopId, options).then((assessments) => {
const promises = assessments.map((assessment) => { const promises = [];
return this.getSubmissionById(workshopId, assessment.submissionid, options).then((submission) => { assessments.forEach((assessment) => {
promises.push(this.getSubmissionById(workshopId, assessment.submissionid, options).then((submission) => {
assessment.submission = submission; assessment.submission = submission;
}); }));
promises.push(this.workshopProvider.getAssessmentForm(workshopId, assessment.id, options).then((assessmentForm) => {
assessment.form = assessmentForm;
}));
}); });
return Promise.all(promises).then(() => { return Promise.all(promises).then(() => {

View File

@ -142,6 +142,11 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH
files = files.concat(assessment.feedbackattachmentfiles) files = files.concat(assessment.feedbackattachmentfiles)
.concat(assessment.feedbackcontentfiles); .concat(assessment.feedbackcontentfiles);
}); });
if (workshop.phase >= AddonModWorkshopProvider.PHASE_ASSESSMENT && canAssess) {
return Promise.all(assessments.map((assessment) => {
return this.workshopHelper.getReviewerAssessmentById(workshop.id, assessment.id);
}));
}
})); }));
}); });