From 558ce33192e5d26554457b74af6ea82ed8198c93 Mon Sep 17 00:00:00 2001 From: Christopher Bohn <bohn@unl.edu> Date: Thu, 9 Jul 2020 11:13:43 -0500 Subject: [PATCH] Fixed bugs when grading team contributions without common project prefix - Handles bad entry of path - Handles project team with no students --- grade_team_contribution.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/grade_team_contribution.py b/grade_team_contribution.py index 151f23c..7dd310f 100644 --- a/grade_team_contribution.py +++ b/grade_team_contribution.py @@ -4,6 +4,8 @@ from datetime import date from math import ceil, log10 from typing import Tuple +from gitlab import GitlabError + from api.canvas_classes import * from api.gitlab_classes import * from common_functions import select_from_list, strip_html @@ -176,8 +178,19 @@ if __name__ == '__main__': print() if grading_git_histories: if no_common_prefix: - custom_project = input(f'Enter path to {student_group.get_name()}\'s repository: ') - display_git_contributions(GitlabProject(custom_project)) + custom_project: str = None + repository: GitlabProject = None + while custom_project is None: + custom_project = input( + f'Enter path to {student_group.get_name()}\'s repository (leave blank to skip): ') + try: + if len(custom_project) > 0: + repository = GitlabProject(custom_project) + except GitlabError: + print(f'Could not location repository {custom_project}; please confirm path.') + custom_project = None + if len(custom_project) > 0: + display_git_contributions(repository) else: project_name = f'{project_prefix}{student_group.get_name().split()[1]}'.zfill(zero_padding) display_git_contributions(list(filter(lambda p: p.get_name() == project_name, projects))[0]) -- GitLab