Skip to content

Commit

Permalink
fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsm committed Nov 15, 2014
2 parents 8086cea + 2539f45 commit 58045c3
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 76 deletions.
4 changes: 3 additions & 1 deletion website/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
problems = models.ManyToManyField(Problem)
points = models.IntegerField()
received_submission = models.BooleanField(null=True, blank=True)
16 changes: 11 additions & 5 deletions website/package_problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
29 changes: 8 additions & 21 deletions website/templates/grader.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DibTeX</title>
<!-- Bootstrap -->
<link href="../static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="../static/css/grader.css" rel="stylesheet">
{% extends "base.html" %}

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
{% block title %}test{% endblock %}

{% block content %}

{% for assignment in assignments %}
<div class = "bg">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
Expand Down Expand Up @@ -53,10 +41,10 @@
<div class = "row">
<div id = "picturecontainer">
<div class = "col-md-6" id="left">
<object data="../static/css/casgt01.pdf"></object>
<object data= {{solutions}}></object>
</div>
<div class = "col-md-6 " id="right">
<object data="../static/css/casgt09.pdf"></object>
<object data={{submission}}></object>
</div>
</div>
</div>
Expand All @@ -69,7 +57,6 @@


</div>
</body>
</html>
{% endblock %}


82 changes: 33 additions & 49 deletions website/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,57 +16,45 @@
</tr>
</thead>
<tbody>
<tr class="danger"> <!--info for blue success for green><!-->
<td>11/16/1994</td>
<td>Ramsey Theory</td>

{% for assignment in assignments %}
{% if assignment.received_submission == "False" %}
<tr class="danger"> <!--info for blue success for green><!-->
<td>{{assignment.due_date}}</td>
<td>{{assignment.name}}</td>
<td>Haven't started</td>
<td>47/50</td>
<td> <form method="get" action="casgt07.pdf">
<button type="submit">Download .tex file</button>
</form>
</td>
<td>/{{assignment.points}}</td>
<td>

<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="input-group">
<div class="uneditable-input col-lg-3"><i class="icon-file fileupload-exists"></i> <span class="fileupload-preview"></span></div><span class="btn btn-default btn-file"><span class="fileupload-new">Select file</span><span class="fileupload-exists">Change</span><input type="file"><a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a></span>
</div>
</div>
<form method="get" action="casgt07.pdf">
<button type="submit">Download .tex file</button>
</form>
</td>
</tr>
{% for entry in blog_entries %}
{% if item.status == "nostart" %}
<tr class="danger"> <!--info for blue success for green><!-->
<td>11/16/1994</td>
<td>Ramsey Theory</td>
<td>Haven't started</td>
<td>/50</td>
<td> <form method="get" action="casgt07.pdf">
<button type="submit">Download .tex file</button>
</form>
</td>
<td>

<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="input-group">
<div class="uneditable-input col-lg-3"><i class="icon-file fileupload-exists"></i> <span class="fileupload-preview"></span></div><span class="btn btn-default btn-file"><span class="fileupload-new">Select file</span><span class="fileupload-exists">Change</span><input type="file"><a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a></span>
</div>
</div>
<div class="fileupload fileupload-new" data-provides="fileupload">
<div class="input-group">
<div class="uneditable-input col-lg-3"><i class="icon-file fileupload-exists"></i>
<span class="fileupload-preview"></span></div>
<span class="btn btn-default btn-file"><span class="fileupload-new">Select file</span>
<span class="fileupload-exists">Change</span>
<input type="file"><a href="#" class="btn fileupload-exists" data-dismiss="fileupload">Remove</a>
</span>
</div>
</div>
</td>
</tr>
{% else if item.stats = "submitted"%}
{% else if assignment.received_submission == "True"%}
<tr class="info"> <!--info for blue success for green><!-->
<td>11/16/1994</td>
<td>Ramsey Theory</td>
<td>{{assignment.due_date}}</td>
<td>{{assignment.name}}</td>
<td>Submitted</td>
<td>/50</td>
<td>47/{{assignment.points}}</td>
<td> <form method="get" action="casgt07.pdf">
<button type="submit">Download .tex file</button>
</form>
</td>
<button type="submit">Download .tex file</button>
</form>
</td>
<td>

Submitted on DATE
Submitted on DATE
</td>
</tr>
{% else %}
Expand All @@ -76,22 +64,18 @@
<td>Submitted</td>
<td>VALUE/50</td>
<td> <form method="get" action="casgt07.pdf">
<button type="submit">Download .tex file</button>
</form>
</td>
Submitted on DATE
<button type="submit">Download .tex file</button>
</form>
</td>
Submitted on DATE
<td>

File sumitted on DATE
</td>
</tr>
{% endif %}




{% endfor %}
</tbody>
</table>
{% endfor %}
{% endblock %}

21 changes: 21 additions & 0 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import os
import aggregator
from website.models import Assignment, Problem
import package_problems

def professor(request):
if request.method == 'POST':
Expand All @@ -19,6 +20,26 @@ 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 grader(request):
ass = Assignment.objects.all()
list_of_list_of_problems = {}
for a in ass:
problems = package_problems.problem_answer_pairings(a)
list_of_list_of_problems.append(problems)

return render(request, "grader.html", {'problem_solution_pair_list': list_of_list_of_problems})


def process_prof_file(file):
data = file.read()
Expand Down

0 comments on commit 58045c3

Please sign in to comment.