def restore_group_meeting_tasks(json): for group_meeting_task in json: group = GroupYear.get(group=group_meeting_task["group"], year="active") meeting = UUID(group_meeting_task["meeting"]) group_meeting = GroupMeeting.get(group=group, meeting=meeting) GroupMeetingTask(group=group_meeting, task=group_meeting_task["task"]) arr = GroupMeetingTask.select()[:] print("===RESTORED {0} {1}===".format(len(arr), "GroupMeetingTasks"))
def restore_group_meeting_files(json): for group_meeting_file in json: group_year = GroupYear.get(group=group_meeting_file["group"], year="active") group_meeting = GroupMeeting.get(group=group_year, meeting=UUID( group_meeting_file["meeting"])) group_task = GroupMeetingTask.get(group=group_meeting, task=group_meeting_file["task"]) date = datetime.strptime(group_meeting_file["date"], date_format) GroupMeetingFile(group_task=group_task, file_location=group_meeting_file["file_location"], date=date) arr = GroupMeetingFile.select()[:] print("===RESTORED {0} {1}===".format(len(arr), "GroupMeetingFile"))
def get_group_meeting_by_code(code: UUID) -> Optional[GroupMeeting]: return GroupMeeting.get(code=code)
def get_group_meeting(meeting_id: UUID, group_name: str, year: str) -> Optional[GroupMeeting]: group_year = get_group_year(group_name, year) return GroupMeeting.get(group=group_year, meeting=meeting_id)