diff --git a/src/addons/mod/workshop/services/workshop-sync.ts b/src/addons/mod/workshop/services/workshop-sync.ts index aef9e01ce..f156c3e36 100644 --- a/src/addons/mod/workshop/services/workshop-sync.ts +++ b/src/addons/mod/workshop/services/workshop-sync.ts @@ -205,14 +205,23 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider = {}; const promises: Promise[] = []; - promises.push(this.syncSubmission(workshop, submissionsActions, result, siteId).then(() => { - result.updated = true; + submissionsActions.forEach((action) => { + offlineSubmissions[action.submissionid] = offlineSubmissions[action.submissionid] || []; + offlineSubmissions[action.submissionid].push(action); + }); - return; - })); + Object.keys(offlineSubmissions).forEach((submissionId) => { + const submissionActions = offlineSubmissions[submissionId]; + promises.push(this.syncSubmission(workshop, submissionActions, result, siteId).then(() => { + result.updated = true; + + return; + })); + }); assessments.forEach((assessment) => { promises.push(this.syncAssessment(workshop, assessment, result, siteId).then(() => { @@ -444,7 +453,7 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProviderinputData.feedbackauthorattachmentsid, workshop.id,