MOBILE-3320 core: Fix bugs with concat(), like notes sync
parent
7c2867fedc
commit
dd2eb1fc97
|
@ -546,12 +546,12 @@ export class AddonCalendarHelperProvider {
|
||||||
const site = await CoreSites.getSite(siteId);
|
const site = await CoreSites.getSite(siteId);
|
||||||
const fetchTimestarts: number[] = [];
|
const fetchTimestarts: number[] = [];
|
||||||
const invalidateTimestarts: number[] = [];
|
const invalidateTimestarts: number[] = [];
|
||||||
const promises: Promise<unknown>[] = [];
|
let promises: Promise<unknown>[] = [];
|
||||||
|
|
||||||
// Always fetch upcoming events.
|
// Always fetch upcoming events.
|
||||||
promises.push(AddonCalendar.getUpcomingEvents(undefined, undefined, true, site.id));
|
promises.push(AddonCalendar.getUpcomingEvents(undefined, undefined, true, site.id));
|
||||||
|
|
||||||
promises.concat(events.map(async (eventData) => {
|
promises = promises.concat(events.map(async (eventData) => {
|
||||||
|
|
||||||
if (eventData.repeated <= 1) {
|
if (eventData.repeated <= 1) {
|
||||||
// Not repeated.
|
// Not repeated.
|
||||||
|
|
|
@ -48,13 +48,13 @@ export class AddonModForumPrefetchHandlerService extends CoreCourseActivityPrefe
|
||||||
try {
|
try {
|
||||||
const forum = await AddonModForum.getForum(courseId, module.id);
|
const forum = await AddonModForum.getForum(courseId, module.id);
|
||||||
|
|
||||||
const files = this.getIntroFilesFromInstance(module, forum);
|
let files = this.getIntroFilesFromInstance(module, forum);
|
||||||
|
|
||||||
// Get posts.
|
// Get posts.
|
||||||
const posts = await this.getPostsForPrefetch(forum, { cmId: module.id });
|
const posts = await this.getPostsForPrefetch(forum, { cmId: module.id });
|
||||||
|
|
||||||
// Add posts attachments and embedded files.
|
// Add posts attachments and embedded files.
|
||||||
files.concat(this.getPostsFiles(posts));
|
files = files.concat(this.getPostsFiles(posts));
|
||||||
|
|
||||||
return files;
|
return files;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -573,7 +573,6 @@ class AddonModGlossaryEntriesManager extends CorePageItemsListManager<EntryItem>
|
||||||
*/
|
*/
|
||||||
setOnlineEntries(onlineEntries: AddonModGlossaryEntry[], hasMoreItems: boolean = false): void {
|
setOnlineEntries(onlineEntries: AddonModGlossaryEntry[], hasMoreItems: boolean = false): void {
|
||||||
this.setItems((<EntryItem[]> this.offlineEntries).concat(onlineEntries), hasMoreItems);
|
this.setItems((<EntryItem[]> this.offlineEntries).concat(onlineEntries), hasMoreItems);
|
||||||
this.onlineEntries.concat(onlineEntries);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -583,7 +582,6 @@ class AddonModGlossaryEntriesManager extends CorePageItemsListManager<EntryItem>
|
||||||
*/
|
*/
|
||||||
setOfflineEntries(offlineEntries: AddonModGlossaryOfflineEntry[]): void {
|
setOfflineEntries(offlineEntries: AddonModGlossaryOfflineEntry[]): void {
|
||||||
this.setItems((<EntryItem[]> offlineEntries).concat(this.onlineEntries), this.hasMoreItems);
|
this.setItems((<EntryItem[]> offlineEntries).concat(this.onlineEntries), this.hasMoreItems);
|
||||||
this.offlineEntries = offlineEntries;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -62,12 +62,10 @@ export class AddonNotesSyncProvider extends CoreSyncBaseProvider<AddonNotesSyncR
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Get all the courses to be synced.
|
// Get all the courses to be synced.
|
||||||
const courseIds: number[] = [];
|
let courseIds: number[] = [];
|
||||||
notesArray.forEach((notes: (AddonNotesDeletedDBRecord | AddonNotesDBRecord)[]) => {
|
notesArray.forEach((notes: (AddonNotesDeletedDBRecord | AddonNotesDBRecord)[]) => {
|
||||||
const courseIds = notes.map((note) => note.courseid);
|
courseIds = courseIds.concat(notes.map((note) => note.courseid));
|
||||||
|
});
|
||||||
courseIds.concat(courseIds);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
CoreUtils.uniqueArray(courseIds);
|
CoreUtils.uniqueArray(courseIds);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ export function buildTabMainRoutes(injector: Injector, mainRoute: Route): Routes
|
||||||
|
|
||||||
mainRoute.path = mainRoute.path || '';
|
mainRoute.path = mainRoute.path || '';
|
||||||
mainRoute.children = mainRoute.children || [];
|
mainRoute.children = mainRoute.children || [];
|
||||||
mainRoute.children.concat(routes.children);
|
mainRoute.children = mainRoute.children.concat(routes.children);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
mainRoute,
|
mainRoute,
|
||||||
|
|
Loading…
Reference in New Issue