From ba912de7f312f130e6916f067c15585143dfd6c2 Mon Sep 17 00:00:00 2001 From: Raphael Maenle Date: Mon, 18 May 2020 23:49:26 +0200 Subject: [PATCH] updates routine to use calendar_id - calendar name creates problems, when two calendars have the same name - calendar id is unique and was added into the css of the frontend y --- Routine.py | 3 +-- caltojson.py | 4 +--- colors.json | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Routine.py b/Routine.py index 9ae1cfc..a5ec40f 100644 --- a/Routine.py +++ b/Routine.py @@ -24,9 +24,8 @@ class Routine: calendars = db.session.query(Calendar).filter(Calendar.usr_id==user.id).all() for calendar in calendars: if calendar.toggle == 'True': - visualCals.append(calendar.name) + visualCals.append(calendar.calendar_id) googleCreds = google.oauth2.credentials.Credentials(**credentials) - print(credentials_to_dict(googleCreds), flush=True) calendarjson = caltojson.generateJsonFromCalendarEntries(visualCals, googleCreds) user.setJson(calendarjson) directory = 'userinfo/' + user.id + '/' diff --git a/caltojson.py b/caltojson.py index e604a5d..4fac74b 100644 --- a/caltojson.py +++ b/caltojson.py @@ -118,7 +118,7 @@ def getCalendars(service): def purgeCalendars(calendars, visibleCalendars): purged = [] for calendar in calendars: - if calendar.summary in visibleCalendars: + if calendar.calendarId in visibleCalendars: purged.append(calendar) return purged @@ -191,8 +191,6 @@ def forEventGetColor(event, colormap, colors): else: calColorId = toCalendarColorId(colormap, event.eventColorId) bg = colors['calendar'][calColorId]['background'] - print(event.name) - print(bg) return toNaturalColor(colormap, bg) def toJson(events): diff --git a/colors.json b/colors.json index ac2bd03..f4c3c9f 100644 --- a/colors.json +++ b/colors.json @@ -90,7 +90,7 @@ }, { "api": "#cd74e6", - "natural": "#8E24AA" + "natural": "#ff00cc" }, { "api": "#a47ae2",