MOBILE-2354 workshop: PR fixes
parent
71a5999c60
commit
973f1cdc72
|
@ -6,7 +6,6 @@
|
|||
<core-dynamic-component [component]="componentClass" [data]="data"></core-dynamic-component>
|
||||
</ng-container>
|
||||
|
||||
<!-- This content will be replaced by the directive if any is applied. -->
|
||||
<div class="core-info-card" *ngIf="notSupported">
|
||||
{{ 'addon.mod_workshop.assessmentstrategynotsupported' | translate:{$a: strategy} }}
|
||||
</div>
|
||||
|
|
|
@ -263,7 +263,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit {
|
|||
/**
|
||||
* Save the assessment.
|
||||
*
|
||||
* @return {Promise<any>} Promise resolved when done.
|
||||
* @return {Promise<any>} Promise resolved when done, rejected if assessment could not be saved.
|
||||
*/
|
||||
saveAssessment(): Promise<any> {
|
||||
const files = this.fileSessionProvider.getFiles(AddonModWorkshopProvider.COMPONENT,
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1060,7 +1060,7 @@ export class AddonModWorkshopProvider {
|
|||
* @param {string} [siteId] Site ID. If not defined, current site.
|
||||
* @return {Promise<any>} 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<any> {
|
||||
return this.sitesProvider.getSite(siteId).then((site) => {
|
||||
return site.invalidateWsCacheForKey(this.getAssessmentFormDataCacheKey(workshopId, assessmentId, mode));
|
||||
|
|
Loading…
Reference in New Issue