MOBILE-3049 sitehome: Fix activities not displayed

main
Albert Gasset 2019-05-24 12:48:44 +02:00
parent ba9564d96f
commit f06e25d1cd
2 changed files with 4 additions and 3 deletions

View File

@ -75,7 +75,7 @@ export class AddonBlockSiteMainMenuComponent extends CoreBlockBaseComponent impl
*/
protected fetchContent(): Promise<any> {
return this.courseProvider.getSections(this.siteHomeId, false, true).then((sections) => {
this.block = sections[0];
this.block = sections.find((section) => section.section == 0);
if (this.block) {
this.block.hasContent = this.courseHelper.sectionHasContent(this.block);

View File

@ -137,7 +137,7 @@ export class CoreSiteHomeIndexComponent implements OnInit {
return this.courseProvider.getSections(this.siteHomeId, false, true).then((sections) => {
// Check "Include a topic section" setting from numsections.
this.section = config.numsections ? sections[1] : false;
this.section = config.numsections ? sections.find((section) => section.section == 1) : false;
if (this.section) {
this.section.hasContent = this.courseHelper.sectionHasContent(this.section);
this.hasContent = this.courseHelper.addHandlerDataForModules([this.section], this.siteHomeId) || this.hasContent;
@ -164,7 +164,8 @@ export class CoreSiteHomeIndexComponent implements OnInit {
this.blocks = [];
// Cannot get the blocks, just show site main menu if needed.
if (sections[0] && this.courseHelper.sectionHasContent(sections[0])) {
const section = sections.find((section) => section.section == 0);
if (section && this.courseHelper.sectionHasContent(section)) {
this.blocks.push({
name: 'site_main_menu'
});