Пример #1
0
#!/usr/bin/env python

import re
import sys

import yaml

from canvasgrade import config
from canvasgrade import cgfilter

courses = config.get_courses()
students = dict()

if len(sys.argv) >= 2:
    courses = cgfilter.courses(courses, sys.argv[1:])

for course in courses:
    students[course["tag"]] = config.get_students(course["tag"])

multiple = len(students) > 1
indent = "  -" if multiple else "-"
for course_tag in students.keys():
    if multiple:
        print(course_tag, ":", sep="")
    for student in students[course_tag]:
        print(indent, student['tag'])
Пример #2
0
from canvasgrade import cgfilter

args = [bit for arg in sys.argv[1:] for bit in arg.split('/')]

courses = config.get_courses()

courses = config.get_courses()
if len(args) >= 1:
    courses = cgfilter.courses(courses, args[0:1])

for course in courses:
    assignments = config.get_assignments(course['tag'])
    if len(args) >= 2:
        assignments = cgfilter.assignments(assignments, args[1:2])
    for assignment in assignments:
        students = config.get_students(course['tag'])
        if len(args) >= 3:
            students = cgfilter.students(students, args[2:3])
        for student in students:
            submission = None
            try:
                submission = config.get_submission(course['tag'],
                                                   assignment['tag'],
                                                   student['tag'])
            except:
                pass
            if submission:
                try:
                    grade = config.get_grade(course['tag'], assignment['tag'],
                                             student['tag'])
                except: