diff --git a/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.html b/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.html index 68bb847bb..cf21347bf 100644 --- a/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.html +++ b/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.html @@ -6,7 +6,6 @@ -
{{ 'addon.mod_workshop.assessmentstrategynotsupported' | translate:{$a: strategy} }}
diff --git a/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts b/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts index 6ce7c2a65..05431ba3d 100644 --- a/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts +++ b/src/addon/mod/workshop/components/assessment-strategy/assessment-strategy.ts @@ -263,7 +263,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit { /** * Save the assessment. * - * @return {Promise} Promise resolved when done. + * @return {Promise} Promise resolved when done, rejected if assessment could not be saved. */ saveAssessment(): Promise { const files = this.fileSessionProvider.getFiles(AddonModWorkshopProvider.COMPONENT, diff --git a/src/addon/mod/workshop/components/index/index.ts b/src/addon/mod/workshop/components/index/index.ts index 4c626f1bd..ffa4ee648 100644 --- a/src/addon/mod/workshop/components/index/index.ts +++ b/src/addon/mod/workshop/components/index/index.ts @@ -88,10 +88,7 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity // Since most actions will take the user out of the app, we should refresh the view when the app is resumed. this.appResumeSubscription = platform.resume.subscribe(() => { - this.content && this.content.scrollToTop(); - - this.loaded = false; - this.refreshContent(true, false); + this.showLoadingAndRefresh(true); }); // Refresh workshop on sync. @@ -114,6 +111,8 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity this.workshopProvider.logView(this.workshop.id).then(() => { this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus); + }).catch((error) => { + // Ignore errors. }); }); } @@ -125,10 +124,8 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity */ protected eventReceived(data: any): void { if ((this.workshop && this.workshop.id === data.workshopId) || data.cmId === this.module.id) { - this.content && this.content.scrollToTop(); + this.showLoadingAndRefresh(true); - this.loaded = false; - this.refreshContent(true, false); // Check completion since it could be configured to complete once the user adds a new discussion or replies. this.courseProvider.checkModuleCompletion(this.courseId, this.module.completionstatus); } @@ -223,8 +220,6 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity } }); } - - return Promise.resolve(); }).then(() => { return this.workshopProvider.getUserPlanPhases(this.workshop.id); }).then((phases) => { diff --git a/src/addon/mod/workshop/providers/prefetch-handler.ts b/src/addon/mod/workshop/providers/prefetch-handler.ts index 1c641fb57..0dc4f488e 100644 --- a/src/addon/mod/workshop/providers/prefetch-handler.ts +++ b/src/addon/mod/workshop/providers/prefetch-handler.ts @@ -154,14 +154,14 @@ export class AddonModWorkshopPrefetchHandler extends CoreCourseModulePrefetchHan groups: groups, files: files.filter((file) => typeof file !== 'undefined') }; - }).catch((message) => { + }).catch((message): any => { if (omitFail) { // Any error, return the info we have. - return Promise.resolve({ + return { workshop: workshop, groups: groups, files: files.filter((file) => typeof file !== 'undefined') - }); + }; } return Promise.reject(message); diff --git a/src/addon/mod/workshop/providers/workshop.ts b/src/addon/mod/workshop/providers/workshop.ts index cb7757834..5a1a1c5c3 100644 --- a/src/addon/mod/workshop/providers/workshop.ts +++ b/src/addon/mod/workshop/providers/workshop.ts @@ -1060,7 +1060,7 @@ export class AddonModWorkshopProvider { * @param {string} [siteId] Site ID. If not defined, current site. * @return {Promise} Promise resolved when the data is invalidated. */ - invalidateAssessmentFormData(workshopId: number, assessmentId: number, mode: string = 'assesssment', siteId?: string): + invalidateAssessmentFormData(workshopId: number, assessmentId: number, mode: string = 'assessment', siteId?: string): Promise { return this.sitesProvider.getSite(siteId).then((site) => { return site.invalidateWsCacheForKey(this.getAssessmentFormDataCacheKey(workshopId, assessmentId, mode));