routine no longer creates file
This commit is contained in:
parent
060e506547
commit
f94c64e699
14
Routine.py
14
Routine.py
@ -12,13 +12,11 @@ class Routine:
|
||||
self.updateCalendars()
|
||||
|
||||
|
||||
def updateCalendars(self):
|
||||
users = User.query.all()
|
||||
for user in users:
|
||||
def updateCalendar(self, user):
|
||||
# check google:
|
||||
credentials = user.getGoogleCredentials()
|
||||
if credentials is None:
|
||||
continue
|
||||
return
|
||||
|
||||
visualCals = []
|
||||
calendars = db.session.query(Calendar).filter(Calendar.usr_id==user.id).all()
|
||||
@ -28,11 +26,19 @@ class Routine:
|
||||
googleCreds = google.oauth2.credentials.Credentials(**credentials)
|
||||
calendarjson = caltojson.generateJsonFromCalendarEntries(visualCals, googleCreds)
|
||||
user.setJson(calendarjson)
|
||||
'''
|
||||
directory = 'userinfo/' + user.id + '/'
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
with open(directory + 'calendarevents.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(calendarjson, f, ensure_ascii=False, indent=4)
|
||||
'''
|
||||
|
||||
|
||||
def updateCalendars(self):
|
||||
users = User.query.all()
|
||||
for user in users:
|
||||
self.updateCalendar(user)
|
||||
|
||||
def credentials_to_dict(credentials):
|
||||
return{'token': credentials.token,
|
||||
|
Loading…
Reference in New Issue
Block a user