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
This commit is contained in:
Raphael Maenle 2020-05-18 23:49:26 +02:00
parent 804ab33a6d
commit ba912de7f3
3 changed files with 3 additions and 6 deletions

View File

@ -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 + '/'

View File

@ -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):

View File

@ -90,7 +90,7 @@
},
{
"api": "#cd74e6",
"natural": "#8E24AA"
"natural": "#ff00cc"
},
{
"api": "#a47ae2",