From 43c484a302e795a3e7a97e45f6ce9705b1e19fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 21 Nov 2019 16:05:19 +0100 Subject: [PATCH] MOBILE-3136 calendar: Fix param pass to day view --- src/addon/calendar/pages/day/day.ts | 8 ++++++-- src/addon/calendar/pages/index/index.ts | 6 +++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/addon/calendar/pages/day/day.ts b/src/addon/calendar/pages/day/day.ts index 8b195462c..b48a7d84f 100644 --- a/src/addon/calendar/pages/day/day.ts +++ b/src/addon/calendar/pages/day/day.ts @@ -108,9 +108,13 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy { const now = new Date(); AddonCalendarProvider.ALL_TYPES.forEach((name) => { - this.filter[name] = true; + this.filter[name] = navParams.get(name); + this.filter[name] = typeof this.filter[name] == 'undefined' ? true : this.filter[name]; }); - this.filter['courseId'] = navParams.get('courseId'); + this.filter.courseId = navParams.get('courseId'); + this.filter.categoryId = navParams.get('categoryId'); + + this.filter.filtered = this.filter.courseId || AddonCalendarProvider.ALL_TYPES.some((name) => !this.filter[name]); this.year = navParams.get('year') || now.getFullYear(); this.month = navParams.get('month') || (now.getMonth() + 1); diff --git a/src/addon/calendar/pages/index/index.ts b/src/addon/calendar/pages/index/index.ts index 98fbc5316..6cdf432b2 100644 --- a/src/addon/calendar/pages/index/index.ts +++ b/src/addon/calendar/pages/index/index.ts @@ -324,9 +324,9 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy { year: data.year }; - if (this.filter.courseId) { - params.courseId = this.filter.courseId; - } + Object.keys(this.filter).forEach((key) => { + params[key] = this.filter[key]; + }); this.navCtrl.push('AddonCalendarDayPage', params); }