def get_active_group_email_datas_for_meeting( meeting_id: UUID) -> List[GroupMeetingEmailData]: group_meetings = list( GroupMeeting.select( lambda group_meeting: group_meeting.meeting.id == meeting_id and group_meeting.group.year == "active")) gm_email_datas = [] for group_meeting in group_meetings: m = group_meeting.meeting group = group_meeting.group.group task_names = get_tasks_for_group_meeting(group_meeting) gm_email_datas.append( GroupMeetingEmailData(meeting=MeetingData( id=m.id, year=m.year, date=m.date, last_upload=m.last_upload, lp=m.lp, meeting_no=m.meeting_no), group_name=group.name, group_year=group_meeting.group.year, group_display_name=group.display_name, group_code=group_meeting.code, task_names=task_names)) return gm_email_datas
def restore_group_meetings(json): for group_meeting in json: group_year = GroupYear.get(group=group_meeting["group"], year="active") GroupMeeting(group=group_year, meeting=UUID(group_meeting["meeting"]), code=UUID(group_meeting["code"])) arr = GroupMeeting.select()[:] print("===RESTORED {0} {1}===".format(len(arr), "GroupMeetings"))
def get_group_meetings(): arr = [] group_meetings = GroupMeeting.select() for meeting in group_meetings: arr.append({ "group": meeting.group.name, "meeting": str(meeting.meeting.id), "code": str(meeting.code) }) print("===SAVING {0} {1}===".format(len(arr), "GroupMeetings")) return arr