From 03eda3425520090fb170a351c8c834a04f4c402d Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Fri, 23 Jan 2015 15:33:13 +0100 Subject: Move get_aux_code to tutor/models.py --- monkey/test.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/monkey/test.py b/monkey/test.py index 3143274..f8264b0 100755 --- a/monkey/test.py +++ b/monkey/test.py @@ -19,7 +19,7 @@ from .util import indent os.environ['DJANGO_SETTINGS_MODULE'] = 'webmonkey.settings' django.setup() from django.contrib.auth.models import User -from tutor.models import Attempt, Problem +from tutor.models import Attempt, Problem, get_aux_code # Get problem id from commandline. if len(sys.argv) < 2: @@ -29,15 +29,16 @@ pid = int(sys.argv[1]) # Analyze traces for this problem to get edits, submissions and queries. problem = Problem.objects.get(pk=pid) -attempts = Attempt.objects.filter(problem=problem) +aux_code = get_aux_code(user=User.objects.get(pk=1), problem=problem) +attempts = Attempt.objects.filter(problem=problem) traces = [a.trace for a in attempts] edits, lines, submissions, queries = get_edits_from_traces(traces) # Find incorrect submissions. incorrect = [] for submission, count in sorted(submissions.items()): - if not test(problem.name, submission): + if not test(problem.name, submission + '\n' + aux_code): # This incorrect submission appeared in [count] attempts. incorrect += [submission]*count @@ -166,5 +167,5 @@ else: # Try finding a fix. print(colored('Analyzing program…', 'yellow')) - solution, steps, fix_time, n_tested = fix(problem.name, code, edits, debug=True) + solution, steps, fix_time, n_tested = fix(problem.name, code, edits, aux_code=aux_code, debug=True) print_hint(solution, steps, fix_time, n_tested) -- cgit v1.2.1