From: Damian Myrda Date: Mon, 18 Nov 2024 23:05:51 +0000 (-0600) Subject: Clear data before adding new data X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=b68c858ddd3ae05c85e10978bc9aeb501dd99bd3;p=csc.git Clear data before adding new data --- diff --git a/schoology.py b/schoology.py index 21de793..1b3df60 100644 --- a/schoology.py +++ b/schoology.py @@ -21,13 +21,13 @@ auth = Auth( api = Schoology(auth) api.limit = 64 -group = Group( - api.get_group(GROUP_ID).title, api.get_group(GROUP_ID).description -) +group = Group(api.get_group(GROUP_ID).title, api.get_group(GROUP_ID).description) group.projects = database.read() def get_members(): + group.leaders = [] + group.members = [] for enrolled in api.get_group_enrollments(GROUP_ID): member = Member(enrolled.name_display) if enrolled.admin == 1: @@ -37,6 +37,7 @@ def get_members(): def get_updates(): + group.updates = [] for update in api.get_group_updates(GROUP_ID): user = api.get_user(update.uid) member = Member(user.name_display) @@ -45,6 +46,7 @@ def get_updates(): def get_events(): + group.events = [] for event in api.get_group_events(GROUP_ID): start = datetime.strptime(event.start, "%Y-%m-%d %H:%M:%S") end = None @@ -55,6 +57,7 @@ def get_events(): def get_discussions(): + group.discussions = [] for discussion in api.get_group_discussions(GROUP_ID): group.discussions.append( Discussion(discussion.id, discussion.title, discussion.body)