Merge pull request #2162 from crazyserver/MOBILE-3136

MOBILE-3136 calendar: Fix param pass to day view
main
Juan Leyva 2019-11-22 10:00:03 +01:00 committed by GitHub
commit 92874fbb75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -108,9 +108,13 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
const now = new Date(); const now = new Date();
AddonCalendarProvider.ALL_TYPES.forEach((name) => { 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.year = navParams.get('year') || now.getFullYear();
this.month = navParams.get('month') || (now.getMonth() + 1); this.month = navParams.get('month') || (now.getMonth() + 1);

View File

@ -324,9 +324,9 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
year: data.year year: data.year
}; };
if (this.filter.courseId) { Object.keys(this.filter).forEach((key) => {
params.courseId = this.filter.courseId; params[key] = this.filter[key];
} });
this.navCtrl.push('AddonCalendarDayPage', params); this.navCtrl.push('AddonCalendarDayPage', params);
} }