Skip to content

Commit

Permalink
Add in debugging print statements
Browse files Browse the repository at this point in the history
  • Loading branch information
PhongT16 committed Nov 9, 2023
1 parent a71cacc commit 71bb709
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion IndividualCalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,5 @@ def process_individual_calendars(calendar, start_date, end_date):
except KeyError as e:
logger.warning(f"Unable to find: " + net_id)

filtered_events = []
# filtered_events = []
return filtered_events
36 changes: 33 additions & 3 deletions OutlookCalendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ def main(configs):

# Retrieve the group member emails
group_members = utils.get_email_list(configs['group_name'], configs['email_list_update_interval'])
#group_members = ["[email protected]"]


# Get access token
access_token = utils.acquire_access_token(app, configs['scopes'])
Expand All @@ -100,16 +102,43 @@ def main(configs):

for group in [group_members[i : i + grouping] for i in range(0, len(group_members), grouping)]:
individual_calendars = IndividualCalendar.get_individual_calendars(start_date, end_date, group, access_token)
#print("Retrieved Individual Calendars from Outlook")
#print(individual_calendars)
individual_calendars_events.extend(IndividualCalendar.process_individual_calendars(individual_calendars, start_date, end_date))

print(f"Number of individual_calendars_events: {len(individual_calendars_events)}")
# print("")
print("individual_calendars_events: ")
for e in individual_calendars_events:
print(e)

print("")
print("----------------------------------------------")
print("")

# Retrieve the shared calendar and process it
shared_calendar_id = SharedCalendar.get_shared_calendar_id(configs['shared_calendar_name'], access_token)
debug_calendar = "NCSA Shared Calendar Two"
# shared_calendar_id = SharedCalendar.get_shared_calendar_id(configs['shared_calendar_name'], access_token)
shared_calendar_id = SharedCalendar.get_shared_calendar_id(debug_calendar, access_token)
shared_calendar = SharedCalendar.get_shared_calendar(shared_calendar_id, start_date, end_date, access_token)
#print("Retrieved Shared Calendar from Outlook")
#print(shared_calendar)
shared_calendar_events, event_ids = SharedCalendar.process_shared_calendar(shared_calendar, group_members)



print(f"Number of shared_calendar_events: {len(shared_calendar_events)}")
for e in shared_calendar_events:
print(e)

print("")
# print("----------------------------------------------")

# Update the shared calendar
SharedCalendar.update_shared_calendar(individual_calendars_events, shared_calendar_events, event_ids, shared_calendar_id, configs['category_name'], configs['category_color'], access_token)

# print("")
print("*****************************************************")
# print("")
if args.manual_update: break

count = count + 1
Expand All @@ -122,7 +151,8 @@ def main(configs):
if not path.exists(configs['vcs_directory']):
raise KeyError(f"{configs['vcs_directory']} does not exist.")

rotate_file_handler_info = handlers.RotatingFileHandler(f"{configs['vcs_directory']}vcs.log", mode='a', maxBytes=2000000, backupCount=2)
debug_file = 'vcs_debug.log'
rotate_file_handler_info = handlers.RotatingFileHandler(f"{configs['vcs_directory']}{debug_file}.log", mode='a', maxBytes=2000000, backupCount=2)
rotate_file_handler_info .setFormatter(fmt=formater)
rotate_file_handler_info .setLevel(logging.DEBUG)

Expand Down

0 comments on commit 71bb709

Please sign in to comment.