Merge pull request #1972 from dpalou/MOBILE-3039

MOBILE-3039 workshop: Prefetch files from submissions to assess
main
Juan Leyva 2019-06-07 11:24:11 +02:00 committed by GitHub
commit 0e23b06cc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 3 deletions

View File

@ -319,17 +319,25 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseActivityPrefetchH
reportPromise = reportPromise.finally(() => {
return this.workshopHelper.getReviewerAssessments(workshop.id, currentUserId, undefined,
undefined, siteId).then((revAssessments) => {
let p = Promise.resolve();
const promises = [];
let files = []; // Files in each submission.
revAssessments.forEach((assessment) => {
if (assessment.submission.authorid == currentUserId) {
p = this.workshopProvider.getAssessment(workshop.id, assessment.id);
promises.push(this.workshopProvider.getAssessment(workshop.id, assessment.id));
}
userIds.push(assessment.reviewerid);
userIds.push(assessment.gradinggradeoverby);
assessments[assessment.id] = assessment;
files = files.concat(assessment.submission.attachmentfiles || [])
.concat(assessment.submission.contentfiles || []);
});
return p;
promises.push(this.filepoolProvider.addFilesToQueue(siteId, files, this.component, module.id));
return Promise.all(promises);
});
});
}