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:
parent
804ab33a6d
commit
ba912de7f3
@ -24,9 +24,8 @@ class Routine:
|
|||||||
calendars = db.session.query(Calendar).filter(Calendar.usr_id==user.id).all()
|
calendars = db.session.query(Calendar).filter(Calendar.usr_id==user.id).all()
|
||||||
for calendar in calendars:
|
for calendar in calendars:
|
||||||
if calendar.toggle == 'True':
|
if calendar.toggle == 'True':
|
||||||
visualCals.append(calendar.name)
|
visualCals.append(calendar.calendar_id)
|
||||||
googleCreds = google.oauth2.credentials.Credentials(**credentials)
|
googleCreds = google.oauth2.credentials.Credentials(**credentials)
|
||||||
print(credentials_to_dict(googleCreds), flush=True)
|
|
||||||
calendarjson = caltojson.generateJsonFromCalendarEntries(visualCals, googleCreds)
|
calendarjson = caltojson.generateJsonFromCalendarEntries(visualCals, googleCreds)
|
||||||
user.setJson(calendarjson)
|
user.setJson(calendarjson)
|
||||||
directory = 'userinfo/' + user.id + '/'
|
directory = 'userinfo/' + user.id + '/'
|
||||||
|
@ -118,7 +118,7 @@ def getCalendars(service):
|
|||||||
def purgeCalendars(calendars, visibleCalendars):
|
def purgeCalendars(calendars, visibleCalendars):
|
||||||
purged = []
|
purged = []
|
||||||
for calendar in calendars:
|
for calendar in calendars:
|
||||||
if calendar.summary in visibleCalendars:
|
if calendar.calendarId in visibleCalendars:
|
||||||
purged.append(calendar)
|
purged.append(calendar)
|
||||||
return purged
|
return purged
|
||||||
|
|
||||||
@ -191,8 +191,6 @@ def forEventGetColor(event, colormap, colors):
|
|||||||
else:
|
else:
|
||||||
calColorId = toCalendarColorId(colormap, event.eventColorId)
|
calColorId = toCalendarColorId(colormap, event.eventColorId)
|
||||||
bg = colors['calendar'][calColorId]['background']
|
bg = colors['calendar'][calColorId]['background']
|
||||||
print(event.name)
|
|
||||||
print(bg)
|
|
||||||
return toNaturalColor(colormap, bg)
|
return toNaturalColor(colormap, bg)
|
||||||
|
|
||||||
def toJson(events):
|
def toJson(events):
|
||||||
|
@ -90,7 +90,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"api": "#cd74e6",
|
"api": "#cd74e6",
|
||||||
"natural": "#8E24AA"
|
"natural": "#ff00cc"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"api": "#a47ae2",
|
"api": "#a47ae2",
|
||||||
|
Loading…
Reference in New Issue
Block a user