Merge pull request #2628 from crazyserver/MOBILE-3523
MOBILE-3523 workshop: Prefetch assessments formsmain
commit
9eae2aec43
|
@ -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) => {
|
||||||
|
|
|
@ -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(() => {
|
||||||
|
|
|
@ -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);
|
||||||
|
}));
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue