forked from EVOgeek/Vmeda.Online
		
	
						commit
						0305dce991
					
				| @ -124,7 +124,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp | |||||||
|         this.selectedGroup = this.group || 0; |         this.selectedGroup = this.group || 0; | ||||||
| 
 | 
 | ||||||
|         this.loadContent(false, true).then(() => { |         this.loadContent(false, true).then(() => { | ||||||
|             if (!this.data) { |             if (!this.data || !this.data.id) { | ||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ ion-app.app-root addon-mod-wiki-index { | |||||||
|     .addon-mod_wiki-page-content { |     .addon-mod_wiki-page-content { | ||||||
|         background-color: $white; |         background-color: $white; | ||||||
|         border-top: 1px solid $gray; |         border-top: 1px solid $gray; | ||||||
|         @include safe-area-padding-horizontal(0px, 0px); |         @include safe-area-padding-horizontal(10px, 10px); | ||||||
|         @include darkmode() { |         @include darkmode() { | ||||||
|             background-color: $black; |             background-color: $black; | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -99,14 +99,14 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp | |||||||
|                 return; |                 return; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             if (this.isMainPage) { |             if (!this.pageId) { | ||||||
|                 this.wikiProvider.logView(this.wiki.id, this.wiki.name).then(() => { |                 this.wikiProvider.logView(this.wiki.id, this.wiki.name).then(() => { | ||||||
|                     this.courseProvider.checkModuleCompletion(this.courseId, this.module.completiondata); |                     this.courseProvider.checkModuleCompletion(this.courseId, this.module.completiondata); | ||||||
|                 }).catch((error) => { |                 }).catch((error) => { | ||||||
|                     // Ignore errors.
 |                     // Ignore errors.
 | ||||||
|                 }); |                 }); | ||||||
|             } else { |             } else { | ||||||
|                 this.wikiProvider.logPageView(this.pageId, this.wiki.id, this.wiki.name).catch(() => { |                 this.wikiProvider.logPageView(this.pageId, this.wiki.id, this.wiki.name).catch((error) => { | ||||||
|                     // Ignore errors.
 |                     // Ignore errors.
 | ||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
| @ -280,9 +280,11 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp | |||||||
|                             this.currentPage = data.pageId; |                             this.currentPage = data.pageId; | ||||||
| 
 | 
 | ||||||
|                             this.showLoadingAndFetch(true, false).then(() => { |                             this.showLoadingAndFetch(true, false).then(() => { | ||||||
|                                 this.wikiProvider.logPageView(this.currentPage, this.wiki.id, this.wiki.name).catch(() => { |                                 if (this.currentPage) { | ||||||
|                                     // Ignore errors.
 |                                     this.wikiProvider.logPageView(this.currentPage, this.wiki.id, this.wiki.name).catch(() => { | ||||||
|                                 }); |                                         // Ignore errors.
 | ||||||
|  |                                     }); | ||||||
|  |                                 } | ||||||
|                             }); |                             }); | ||||||
| 
 | 
 | ||||||
|                             // Stop listening for new page events.
 |                             // Stop listening for new page events.
 | ||||||
|  | |||||||
| @ -185,14 +185,17 @@ export class CoreCourseLogHelperProvider { | |||||||
|      */ |      */ | ||||||
|     protected logOnline(ws: string, data: any, siteId?: string): Promise<any> { |     protected logOnline(ws: string, data: any, siteId?: string): Promise<any> { | ||||||
|         return this.sitesProvider.getSite(siteId).then((site) => { |         return this.sitesProvider.getSite(siteId).then((site) => { | ||||||
|             return site.write(ws, data).then((response) => { |             // Clone to have an unmodified data object.
 | ||||||
|  |             const wsData = Object.assign({}, data); | ||||||
|  | 
 | ||||||
|  |             return site.write(ws, wsData).then((response) => { | ||||||
|                 if (!response.status) { |                 if (!response.status) { | ||||||
|                     return Promise.reject(this.utils.createFakeWSError('')); |                     return Promise.reject(this.utils.createFakeWSError('')); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 // Remove all the logs performed.
 |                 // Remove all the logs performed.
 | ||||||
|                 // TODO: Remove this lines when time is accepted in logs.
 |                 // TODO: Remove this lines when time is accepted in logs.
 | ||||||
|                 return this.deleteWSLogs(ws, data); |                 return this.deleteWSLogs(ws, data, siteId); | ||||||
|             }); |             }); | ||||||
|         }); |         }); | ||||||
|     } |     } | ||||||
| @ -335,8 +338,19 @@ export class CoreCourseLogHelperProvider { | |||||||
|      */ |      */ | ||||||
|     protected syncLogs(logs: any[], siteId: string): Promise<any> { |     protected syncLogs(logs: any[], siteId: string): Promise<any> { | ||||||
|         return Promise.all(logs.map((log) => { |         return Promise.all(logs.map((log) => { | ||||||
|             return this.logOnline(log.ws, this.textUtils.parseJSON(log.data), siteId).then(() => { |             const data = this.textUtils.parseJSON(log.data); | ||||||
|                 return this.deleteWSLogsByComponent(log.component, log.componentid, log.ws); | 
 | ||||||
|  |             return this.logOnline(log.ws, data, siteId).catch((error) => { | ||||||
|  |                 const promise = this.utils.isWebServiceError(error) ? this.deleteWSLogs(log.ws, data, siteId) : Promise.resolve(); | ||||||
|  | 
 | ||||||
|  |                 return promise.catch(() => { | ||||||
|  |                     // Ignore errors.
 | ||||||
|  |                 }).then(() => { | ||||||
|  |                     // The WebService has thrown an error, this means that responses cannot be submitted.
 | ||||||
|  |                     return Promise.reject(error); | ||||||
|  |                 }); | ||||||
|  |             }).then(() => { | ||||||
|  |                 return this.deleteWSLogsByComponent(log.component, log.componentid, log.ws, siteId); | ||||||
|             }); |             }); | ||||||
|         })); |         })); | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -1252,7 +1252,7 @@ export class CoreUtilsProvider { | |||||||
|      * @return Sorted object. |      * @return Sorted object. | ||||||
|      */ |      */ | ||||||
|     sortProperties(obj: object): object { |     sortProperties(obj: object): object { | ||||||
|         if (typeof obj == 'object' && !Array.isArray(obj)) { |         if (obj != null && typeof obj == 'object' && !Array.isArray(obj)) { | ||||||
|             // It's an object, sort it.
 |             // It's an object, sort it.
 | ||||||
|             return Object.keys(obj).sort().reduce((accumulator, key) => { |             return Object.keys(obj).sort().reduce((accumulator, key) => { | ||||||
|                 // Always call sort with the value. If it isn't an object, the original value will be returned.
 |                 // Always call sort with the value. If it isn't an object, the original value will be returned.
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user