MOBILE-3523 data: Fix database prefetch
This commit is contained in:
		
							parent
							
								
									6dac0af34d
								
							
						
					
					
						commit
						042ee24d0a
					
				| @ -260,6 +260,7 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp | ||||
|             sort: Number(this.search.sortBy), | ||||
|             order: this.search.sortDirection, | ||||
|             page: this.search.page, | ||||
|             cmId: this.module.id, | ||||
|         }).then((entries) => { | ||||
|             const numEntries = entries.entries.length; | ||||
|             const numOfflineEntries = entries.offlineEntries.length; | ||||
|  | ||||
| @ -608,8 +608,11 @@ export class AddonModDataProvider { | ||||
|      */ | ||||
|     getDatabaseAccessInformation(dataId: number, options: AddonModDataAccessInfoOptions = {}): Promise<any> { | ||||
|         return this.sitesProvider.getSite(options.siteId).then((site) => { | ||||
|             options.groupId = options.groupId || 0; | ||||
| 
 | ||||
|             const params = { | ||||
|                 databaseid: dataId, | ||||
|                 groupid: options.groupId, | ||||
|             }; | ||||
|             const preSets = { | ||||
|                 cacheKey: this.getDatabaseAccessInformationDataCacheKey(dataId, options.groupId), | ||||
| @ -618,10 +621,6 @@ export class AddonModDataProvider { | ||||
|                 ...this.sitesProvider.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
 | ||||
|             }; | ||||
| 
 | ||||
|             if (typeof options.groupId !== 'undefined') { | ||||
|                 params['groupid'] = options.groupId; | ||||
|             } | ||||
| 
 | ||||
|             return site.read('mod_data_get_data_access_information', params, preSets); | ||||
|         }); | ||||
|     } | ||||
| @ -636,7 +635,7 @@ export class AddonModDataProvider { | ||||
|     getEntries(dataId: number, options: AddonModDataGetEntriesOptions = {}): Promise<AddonModDataEntries> { | ||||
|         options.groupId = options.groupId || 0; | ||||
|         options.sort = options.sort || 0; | ||||
|         options.order || options.order || 'DESC'; | ||||
|         options.order = options.order || 'DESC'; | ||||
|         options.page = options.page || 0; | ||||
|         options.perPage = options.perPage || AddonModDataProvider.PER_PAGE; | ||||
| 
 | ||||
|  | ||||
| @ -22,7 +22,7 @@ import { CoreUtilsProvider } from '@providers/utils/utils'; | ||||
| import { CoreGroupsProvider } from '@providers/groups'; | ||||
| import { CoreTimeUtilsProvider } from '@providers/utils/time'; | ||||
| import { CoreCommentsProvider } from '@core/comments/providers/comments'; | ||||
| import { CoreCourseProvider } from '@core/course/providers/course'; | ||||
| import { CoreCourseProvider, CoreCourseCommonModWSOptions } from '@core/course/providers/course'; | ||||
| import { CoreCourseActivityPrefetchHandlerBase } from '@core/course/classes/activity-prefetch-handler'; | ||||
| import { AddonModDataProvider, AddonModDataEntry } from './data'; | ||||
| import { AddonModDataSyncProvider } from './sync'; | ||||
| @ -100,13 +100,14 @@ export class AddonModDataPrefetchHandler extends CoreCourseActivityPrefetchHandl | ||||
|      * @param options Other options. | ||||
|      * @return Promise resolved with the info fetched. | ||||
|      */ | ||||
|     protected getDatabaseInfoHelper(module: any, courseId: number, omitFail: boolean, options: CoreSitesCommonWSOptions = {}) | ||||
|     protected getDatabaseInfoHelper(module: any, courseId: number, omitFail: boolean, options: CoreCourseCommonModWSOptions = {}) | ||||
|             : Promise<any> { | ||||
|         let database, | ||||
|             groups = [], | ||||
|             entries = [], | ||||
|             files = []; | ||||
| 
 | ||||
|         options.cmId = options.cmId || module.id; | ||||
|         options.siteId = options.siteId || this.sitesProvider.getCurrentSiteId(); | ||||
| 
 | ||||
|         return this.dataProvider.getDatabase(courseId, module.id, options).then((data) => { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user