Browse Source

Show staff submissions to other staff

raylu 14 years ago
parent
commit
c96217c8a6
3 changed files with 10 additions and 2 deletions
  1. 6 1
      pyc/grader/views.py
  2. 1 1
      pyc/templates/lab.html
  3. 3 0
      static/style.css

+ 6 - 1
pyc/grader/views.py

@@ -19,7 +19,12 @@ def password_changed(request):
 def lab(request, lab_id):
 	from datetime import timedelta
 	lab = Lab.objects.get(pk=lab_id)
-	submissions = lab.submission_set.filter(user__is_staff=False).order_by('-grade', 'time')
+
+	submissions = lab.submission_set
+	if not request.user.is_staff:
+		# only staff can see other staff solutions
+		submissions = submissions.filter(user__is_staff=False)
+	submissions = submissions.order_by('-grade', 'time')
 
 	# times are stored in UTC; do the conversion here
 	tzoffset = timedelta(0, 0, 0, 0, 0, -7) # -7 hours

+ 1 - 1
pyc/templates/lab.html

@@ -11,7 +11,7 @@ Lab {{ lab.id }} due {{ lab.due }} at 11:59:59 PDT (UTC-7):
 	<th>Time</th>
 </tr>
 {% for s in submissions %}
-	<tr>
+	<tr{% if s.user.is_staff %} class="staff"{% endif %}>
 	<td>{{ s.user }}</td>
 	<td>
 		{% if staff %}

+ 3 - 0
static/style.css

@@ -9,3 +9,6 @@ table#lab {
 	border: 1px solid #000;
 	padding: 5px;
 }
+#lab tr.staff td {
+	background-color: #ddd;
+}