def instructor_grading_push_grading(ctx, course, assignment_id, to_students, all_teams, only, yes): assignment = get_assignment_or_exit(ctx, course, assignment_id) if to_students: print "You are going to push the grading branches to the student repositories." print "If you do so, students will be able to see their grading!" print print "Are you sure you want to continue? (y/n): ", if not yes: yesno = raw_input() else: yesno = 'y' print 'y' if yesno not in ('y', 'Y', 'yes', 'Yes', 'YES'): ctx.exit(CHISUBMIT_FAIL) print else: print "Pushing grading to staging repositories. Only instructors and graders will" print "be able to access this grading. If you want to push the grading to the" print "student repositories, use the --to-students option" print teams_registrations = get_teams_registrations(course, assignment, only = only, only_ready_for_grading=not all_teams) teams = sorted(teams_registrations.keys(), key=operator.attrgetter("team_id")) for team in teams: registration = teams_registrations[team] print ("Pushing grading branch for team %s... " % team.team_id), gradingrepo_push_grading_branch(ctx.obj['config'], course, team, registration, to_students = to_students) print "done." return CHISUBMIT_SUCCESS
def grader_push_grading_branches(ctx, course, grader_id, assignment_id, only): grader = course.get_grader(grader_id) if not grader: print "Grader %s does not exist" % grader_id ctx.exit(CHISUBMIT_FAIL) assignment = course.get_assignment(assignment_id) if not assignment: print "Assignment %s does not exist" % assignment_id ctx.exit(CHISUBMIT_FAIL) teams = get_teams(course, assignment, grader=grader, only=only, only_ready_for_grading=True) if not teams: ctx.exit(CHISUBMIT_FAIL) for team in teams: print "Pushing grading branch for team %s... " % team.id gradingrepo_push_grading_branch(ctx.obj['config'], course, team, assignment, to_staging=True) return CHISUBMIT_SUCCESS
def grader_push_grading(ctx, course, assignment_id, grader, only, skip_rubric_validation): if grader is None: user = ctx.obj["client"].get_user() grader = get_grader_or_exit(ctx, course, user.username) else: grader = get_grader_or_exit(ctx, course, grader) assignment = get_assignment_or_exit(ctx, course, assignment_id) teams_registrations = get_teams_registrations(course, assignment, grader = grader, only = only, only_ready_for_grading=True) if len(teams_registrations) == 0: print "No teams found" ctx.exit(CHISUBMIT_FAIL) for team, registration in teams_registrations.items(): if not skip_rubric_validation: valid, error_msg = validate_repo_rubric(ctx, course, assignment, team, registration) if not valid: print "Not pushing branch for team %s. Rubric does not validate: %s" % (team.team_id, error_msg) continue print "Pushing grading branch for team %s... " % team.team_id gradingrepo_push_grading_branch(ctx.obj['config'], course, team, registration) return CHISUBMIT_SUCCESS
def instructor_grading_push_grading_branches(ctx, course, assignment_id, to_staging, to_students, all_teams, only): assignment = course.get_assignment(assignment_id) if assignment is None: print "Assignment %s does not exist" % assignment_id ctx.exit(CHISUBMIT_FAIL) teams = get_teams(course, assignment, only=only, only_ready_for_grading=not all_teams) if teams is None: ctx.exit(CHISUBMIT_FAIL) for team in teams: print("Pushing grading branch for team %s... " % team.id), gradingrepo_push_grading_branch(ctx.obj['config'], course, team, assignment, to_staging=to_staging, to_students=to_students) print "done." return CHISUBMIT_SUCCESS
def instructor_grading_push_grading(ctx, course, assignment_id, to_students, all_teams, only, yes): assignment = get_assignment_or_exit(ctx, course, assignment_id) if to_students: print( "You are going to push the grading branches to the student repositories." ) print("If you do so, students will be able to see their grading!") print() print("Are you sure you want to continue? (y/n): ", end=' ') if not yes: yesno = input() else: yesno = 'y' print('y') if yesno not in ('y', 'Y', 'yes', 'Yes', 'YES'): ctx.exit(CHISUBMIT_FAIL) print() else: print( "Pushing grading to staging repositories. Only instructors and graders will" ) print( "be able to access this grading. If you want to push the grading to the" ) print("student repositories, use the --to-students option") print() teams_registrations = get_teams_registrations( course, assignment, only=only, only_ready_for_grading=not all_teams) teams = sorted(list(teams_registrations.keys()), key=operator.attrgetter("team_id")) for team in teams: registration = teams_registrations[team] print(("Pushing grading branch for team %s... " % team.team_id), end=' ') gradingrepo_push_grading_branch(ctx.obj['config'], course, team, registration, to_students=to_students) print("done.") return CHISUBMIT_SUCCESS
def instructor_grading_push_grading_branches(ctx, course, assignment_id, to_staging, to_students, all_teams, only): assignment = course.get_assignment(assignment_id) if assignment is None: print "Assignment %s does not exist" % assignment_id ctx.exit(CHISUBMIT_FAIL) teams = get_teams(course, assignment, only = only, only_ready_for_grading=not all_teams) if teams is None: ctx.exit(CHISUBMIT_FAIL) for team in teams: print ("Pushing grading branch for team %s... " % team.id), gradingrepo_push_grading_branch(ctx.obj['config'], course, team, assignment, to_staging = to_staging, to_students = to_students) print "done." return CHISUBMIT_SUCCESS
def grader_push_grading_branches(ctx, course, grader_id, assignment_id, only): grader = course.get_grader(grader_id) if not grader: print "Grader %s does not exist" % grader_id ctx.exit(CHISUBMIT_FAIL) assignment = course.get_assignment(assignment_id) if not assignment: print "Assignment %s does not exist" % assignment_id ctx.exit(CHISUBMIT_FAIL) teams = get_teams(course, assignment, grader = grader, only = only, only_ready_for_grading=True) if not teams: ctx.exit(CHISUBMIT_FAIL) for team in teams: print "Pushing grading branch for team %s... " % team.id gradingrepo_push_grading_branch(ctx.obj['config'], course, team, assignment, to_staging = True) return CHISUBMIT_SUCCESS