From 933c176601b49af952adf4b58d3cf6fb42caf053 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Mon, 7 Mar 2022 10:59:05 +0100 Subject: [PATCH] Add default location --- src/calendar.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/calendar.js b/src/calendar.js index f9369ed..73a4775 100644 --- a/src/calendar.js +++ b/src/calendar.js @@ -28,7 +28,8 @@ const calendars = { fRtjDkjrZyn6fxd8: { cloud: clouds.ELEVES_ENS, name: 'K-Fêt', - color: '#c63b52' + color: '#c63b52', + default_location: 'K-Fêt' } } @@ -79,6 +80,7 @@ class Calendar { this.name = metadata.name this.short_name = metadata.short_name this.color = metadata.color || calendar[1][4][3] + this.default_location = metadata.default_location this.events = calendar[2] .filter(item => item[0] === 'vevent') .map(item => this._parse_vevent(item[1])) @@ -107,14 +109,8 @@ function fcEventFromjCalEvent(cal) { fcEvent.calendar = cal.name fcEvent.short_name = evt.summary - - if (evt.description) { - fcEvent.description = evt.description - } - - if (evt.location) { - fcEvent.location = evt.location - } + fcEvent.description = evt.description + fcEvent.location = evt.location || cal.default_location if (evt.rrule) { const { freq, byday, interval } = evt.rrule