def retrieve(context): """Retrieve available turned in submission""" course, assignment, submission, move = validate_opts(context) click.echo("[TEST] Running AutoGrad: Retrieving turned in submissions..") # Option 6 a = AutoGrad() # Init a.retrieve(course, assignment, submission) # Get files, download
def grade_local(context): """Grade local files""" course, assignment, submission, move = validate_opts(context) click.echo("[TEST] Running AutoGrad: Manual grade, local files") # Option 2 - Manual grade from local files, no download a = AutoGrad() # Init results = a.grade_files(course, assignment, submission, move)
def grade_download(context): """ Download and grade""" course, assignment, submission, move = validate_opts(context) click.echo("[TEST] Running AutoGrad: Retrieve and grade") # Option 1 - Manual grade, download first a = AutoGrad() # Init a.retrieve(course, assignment, submission) # Get files, download results = a.grade_files( course, assignment, submission, move) # Results of grading. Stored in results.json also
def deploy(context): """Run complete process""" course, assignment, submission, move = validate_opts(context) click.echo("[DEPLOY] Running AutoGrad") # Start a = AutoGrad() # Download, grade, submit and mail. Sheets coming soon a.deploy(course, assignment, submission, move, return_grade=True)
def submit_local(context): """Submit locally graded files to classroom / mail""" course, assignment, submission, move = validate_opts(context) click.echo( "[TEST] Running AutoGrad: Adding to Classroom from local results") # Option 3 - Manual Add to Classroom from graded results a = AutoGrad() # Init # IMPORTANT: Do not delete your logs folder just in case results = a.attach_ids(course, assignment, submission) results = remove_duplicates(results) # Remove old if any # a.log_to_file(results,'res.json') status = a.add_to_classroom(course, assignment, results, return_grade=True)
def mail_local(context): """ Mail locally stored results """ course, assignment, submission = validate_opts(context) click.echo("[TEST] Running AutoGrad: Mail from local results") # Option 4 - Manual mailing import json, os a = AutoGrad() # Init # IMPORTANT: Do not delete your logs folder just in case # dir = os.path.join('logs','2019-06-20-09-17-33', 'results.json') p = '_'.join(course, assignment, submission) dir = os.path.join('logs',p, 'results.json') f = open(dir,'r') res = json.load(f) status = a.send_mail(res)
def submit_local(context): """Submit locally graded files to classroom / mail""" course, assignment, submission = validate_opts(context) click.echo("[TEST] Running AutoGrad: Adding to Classroom from local results") # Option 3 - Manual Add to Classroom from graded results a = AutoGrad() # Init
def mail_local(context): """ Mail locally stored results """ ctx = validate_opts(context) course = ctx['course'] assignment = ctx['assignment'] submission = ctx['submission'] click.echo("[TEST] Running AutoGrad: Mail from local results") # Option 4 - Manual mailing import json, os a = AutoGrad() # Init # IMPORTANT: Do not delete your logs folder just in case p = '_'.join([course, assignment, submission]) dir = os.path.join('logs', p, 'results.json') f = open(dir, 'r') res = json.load(f) f.close() final = remove_duplicates(res) a.log_to_file(final, 'email.json') status = a.send_mail( final ) # Edit sub_limit to allow multiple submissions. Will integrate later a.recycle(os.path.join( 'logs', p, 'results.json')) # recycle results file after mailing
def undo_move(context): ctx = validate_opts(context) course = ctx['course'] assignment = ctx['assignment'] submission = ctx['submission'] a = AutoGrad() assignment_dir = a.get_assignment_dir(course, assignment, submission) graded_dir = a.get_graded_dir(course, assignment, submission) a.undo_move(graded_dir, assignment_dir)
def check(context): """Check available turned in submission""" course, assignment, submission, move = validate_opts(context) click.echo("[TEST] Running AutoGrad: Checking for turned in submissions..") import os a = AutoGrad() # Init a.boot() # Connect to Google APIs. This is not needed when testing subs = a.get_submissions_for_assignment( course, assignment, submission) # Get turned in submissions at = a.get_files_for_download(subs) # Get the .pde file attachments
def check(context): """Check available turned in submission""" course, assignment, submission = validate_opts(context) click.echo("[TEST] Running AutoGrad: Checking for turned in submissions..") import os a = AutoGrad() # Init a.boot() # Connect to Google APIs. This is not needed when testing subs = a.get_submissions_for_assignment(course, assignment, submission) # Get turned in submissions at = a.get_files_for_download(subs) # Get the .pde file attachments name = "turned_in_c%s_a%s_s%s.json" % (course,assignment,submission) logs = os.path.join(a.BASE_DIR, 'logs') fn = os.path.join(logs ,name) if not os.path.exists(logs): os.makedirs(logs) if len(at) > 0: a.log_to_file(at,fn) click.echo("Currently turned in submissions logged to logs/turned_in_c{}_a{}_s{}.json".format(course,assignment,submission))