diff --git a/website/models.py b/website/models.py index a09f95b..dfbf6cd 100644 --- a/website/models.py +++ b/website/models.py @@ -38,4 +38,6 @@ class Submission(models.Model): class Assignment(models.Model): name = models.CharField(max_length=CHARFIELD_MAX_LENGTH) due_date = models.DateTimeField() - problems = models.ManyToManyField(Problem) \ No newline at end of file + problems = models.ManyToManyField(Problem) + points = models.IntegerField() + received_submission = models.BooleanField(null=True, blank=True) \ No newline at end of file diff --git a/website/package_problems.py b/website/package_problems.py index 0f3a4a8..b19cbdb 100644 --- a/website/package_problems.py +++ b/website/package_problems.py @@ -5,14 +5,20 @@ def problem_answer_pairings(asgt): a_n = asgt.name problem_pairings = {} - for p in asgt.problems.all: - name = p.name + + for i in range(0, asgt.problems.count()): + name = asgt.problems[i].name problem_file = open(a_n + "-" + name, 'a') aggregator.print_header(problem_file) - p_h = r"\begin{problem}[" + p.name + "][" + p.points + r"]\\" + p_h = r"\begin{problem}[" + asgt.problems[i].name + "][" + asgt.problems[i].points + r"]\\" print(p_h, file=problem_file) - print(p.content, file=problem_file) + print(asgt.problems[i].content, file=problem_file) print(r"\end{problem}", file=problem_file) - problem_pairings.append(problem_file) + + solution_file = open("SOLUTIONS" + "-" + a_n + "-" + name, 'a') + print(r"\begin{solution}", file=solution_file) + print(asgt.problems[i].solution) + print(r"\end{solution}", file=solution_file) + problem_pairings.append(problem_file, solution_file) return problem_pairings diff --git a/website/templates/grader.html b/website/templates/grader.html index 3c0147e..05fe1c2 100644 --- a/website/templates/grader.html +++ b/website/templates/grader.html @@ -1,22 +1,10 @@ - - - - - - DibTeX - - - +{% extends "base.html" %} - - - - - +{% block title %}test{% endblock %} +{% block content %} + +{% for assignment in assignments %}