Merge pull request 'Add default location' (#13) from thubrecht/default_location into master

Reviewed-on: https://git.rz.ens.wtf/Klub-RZ/metis/pulls/13
This commit is contained in:
tomate 2022-03-07 17:31:19 +01:00
commit b0729d0c2d

View file

@ -28,7 +28,8 @@ const calendars = {
fRtjDkjrZyn6fxd8: { fRtjDkjrZyn6fxd8: {
cloud: clouds.ELEVES_ENS, cloud: clouds.ELEVES_ENS,
name: 'K-Fêt', name: 'K-Fêt',
color: '#c63b52' color: '#c63b52',
default_location: 'K-Fêt'
} }
} }
@ -79,6 +80,7 @@ class Calendar {
this.name = metadata.name this.name = metadata.name
this.short_name = metadata.short_name this.short_name = metadata.short_name
this.color = metadata.color || calendar[1][4][3] this.color = metadata.color || calendar[1][4][3]
this.default_location = metadata.default_location
this.events = calendar[2] this.events = calendar[2]
.filter(item => item[0] === 'vevent') .filter(item => item[0] === 'vevent')
.map(item => this._parse_vevent(item[1])) .map(item => this._parse_vevent(item[1]))
@ -107,14 +109,8 @@ function fcEventFromjCalEvent(cal) {
fcEvent.calendar = cal.name fcEvent.calendar = cal.name
fcEvent.short_name = evt.summary fcEvent.short_name = evt.summary
if (evt.description) {
fcEvent.description = evt.description fcEvent.description = evt.description
} fcEvent.location = evt.location || cal.default_location
if (evt.location) {
fcEvent.location = evt.location
}
if (evt.rrule) { if (evt.rrule) {
const { freq, byday, interval } = evt.rrule const { freq, byday, interval } = evt.rrule