From 830562499c6032f31dd29fe6f6d17dba5c67ccf1 Mon Sep 17 00:00:00 2001 From: Noam Hurwitz Date: Sat, 15 Nov 2014 03:35:51 -0800 Subject: [PATCH 1/2] completed student view --- website/models.py | 4 +- website/templates/index.html | 82 +++++++++++++++--------------------- website/views.py | 11 +++++ 3 files changed, 47 insertions(+), 50 deletions(-) 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/templates/index.html b/website/templates/index.html index ef3d47e..2cd3c50 100644 --- a/website/templates/index.html +++ b/website/templates/index.html @@ -16,57 +16,45 @@ - - 11/16/1994 - Ramsey Theory + + {% for assignment in assignments %} + {% if assignment.received_submission == "False" %} + + {{assignment.due_date}} + {{assignment.name}} Haven't started - 47/50 -
- -
- + /{{assignment.points}} - -
-
-
Select fileChangeRemove -
-
+
+ +
- -{% for entry in blog_entries %} -{% if item.status == "nostart" %} - - 11/16/1994 - Ramsey Theory - Haven't started - /50 -
- -
- - -
-
-
Select fileChangeRemove -
-
+
+
+
+
+ Select file + Change + Remove + +
+
- {% else if item.stats = "submitted"%} + {% else if assignment.received_submission == "True"%} - 11/16/1994 - Ramsey Theory + {{assignment.due_date}} + {{assignment.name}} Submitted - /50 + 47/{{assignment.points}}
- -
- + + + - Submitted on DATE + Submitted on DATE {% else %} @@ -76,22 +64,18 @@ Submitted VALUE/50
- -
- -Submitted on DATE + + + + Submitted on DATE File sumitted on DATE {% endif %} - - - - + {% endfor %} -{% endfor %} {% endblock %} diff --git a/website/views.py b/website/views.py index 4640d73..cb2983c 100644 --- a/website/views.py +++ b/website/views.py @@ -18,6 +18,17 @@ def professor(request): form = ProfessorUploadForm() return render(request, 'profbig.html', {'form': form}) +def student(request): + ass = Assignment.objects.all() + + for a in Assignment.objects.all(): + total_points = 0; + for p in a.problems: + total_points += p.points + a.points = total_points + + return render(request, "index.html", {'assignments': ass}) + def process_prof_file(file): data = file.read() From 2539f459fd911acfb6a2ffaddc7c8a52210fd0dd Mon Sep 17 00:00:00 2001 From: Noam Hurwitz Date: Sat, 15 Nov 2014 03:56:54 -0800 Subject: [PATCH 2/2] added grader view --- website/package_problems.py | 16 +++++++++++----- website/templates/grader.html | 29 ++++++++--------------------- website/views.py | 10 ++++++++++ 3 files changed, 29 insertions(+), 26 deletions(-) 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 %}