MOBILE-3833 assign: Fix error displayed after sync
parent
87c8177d26
commit
1fc0b9184b
|
@ -312,12 +312,13 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if sync has succeed from result sync data.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param result Data returned by the sync function.
|
|
||||||
* @return If succeed or not.
|
|
||||||
*/
|
*/
|
||||||
protected hasSyncSucceed(result: AddonModAssignSyncResult): boolean {
|
protected hasSyncSucceed(result?: AddonModAssignSyncResult): boolean {
|
||||||
|
if (!result) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (result.updated) {
|
if (result.updated) {
|
||||||
this.submissionComponent?.invalidateAndRefresh(false);
|
this.submissionComponent?.invalidateAndRefresh(false);
|
||||||
}
|
}
|
||||||
|
@ -326,9 +327,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform the invalidate content function.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @return Resolved when done.
|
|
||||||
*/
|
*/
|
||||||
protected async invalidateContent(): Promise<void> {
|
protected async invalidateContent(): Promise<void> {
|
||||||
const promises: Promise<void>[] = [];
|
const promises: Promise<void>[] = [];
|
||||||
|
@ -367,10 +366,7 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares sync event data with current data to check if refresh content is needed.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @param syncEventData Data receiven on sync observer.
|
|
||||||
* @return True if refresh is needed, false otherwise.
|
|
||||||
*/
|
*/
|
||||||
protected isRefreshSyncNeeded(syncEventData: AddonModAssignAutoSyncData): boolean {
|
protected isRefreshSyncNeeded(syncEventData: AddonModAssignAutoSyncData): boolean {
|
||||||
if (!this.assign || syncEventData.assignId != this.assign.id) {
|
if (!this.assign || syncEventData.assignId != this.assign.id) {
|
||||||
|
@ -386,20 +382,18 @@ export class AddonModAssignIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs the sync of the activity.
|
* @inheritdoc
|
||||||
*
|
|
||||||
* @return Promise resolved when done.
|
|
||||||
*/
|
*/
|
||||||
protected async sync(): Promise<AddonModAssignSyncResult | void> {
|
protected async sync(): Promise<AddonModAssignSyncResult | void> {
|
||||||
if (!this.assign) {
|
if (!this.assign) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await AddonModAssignSync.syncAssign(this.assign.id);
|
return await AddonModAssignSync.syncAssign(this.assign.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Component being destroyed.
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
super.ngOnDestroy();
|
super.ngOnDestroy();
|
||||||
|
|
Loading…
Reference in New Issue