From 5b28c96a7c6c7614915e9a5d1de3b0cfdf0f79e4 Mon Sep 17 00:00:00 2001
From: janmax <mail-github@jmx.io>
Date: Fri, 5 May 2017 15:56:16 +0200
Subject: [PATCH] More info on submission view for reviewer

---
 core/templates/core/reviewer_startpage.html   |  2 -
 .../core/student_submission_list.html         |  8 +++-
 core/templates/core/submission_view.html      | 37 +++++++++++++++----
 core/views/user_startpages.py                 |  4 +-
 4 files changed, 38 insertions(+), 13 deletions(-)

diff --git a/core/templates/core/reviewer_startpage.html b/core/templates/core/reviewer_startpage.html
index 775f882e..4ca8fc93 100644
--- a/core/templates/core/reviewer_startpage.html
+++ b/core/templates/core/reviewer_startpage.html
@@ -100,8 +100,6 @@
     {% include "core/feedback_list.html" with expanded="show" header="Did not compile feedback" unique="2" feedback_list=feedback_list_did_not_compile %}
     {% include "core/feedback_list.html" with expanded="show" header="Could not link feedback" unique="3" feedback_list=feedback_list_could_not_link %}
     {% include "core/feedback_list.html" with expanded="hide" header="Empty feedback" unique="1" feedback_list=feedback_list_empty %}
-
-
   </div>
 </div>
 
diff --git a/core/templates/core/student_submission_list.html b/core/templates/core/student_submission_list.html
index b6814dd1..5bb703e3 100644
--- a/core/templates/core/student_submission_list.html
+++ b/core/templates/core/student_submission_list.html
@@ -2,7 +2,7 @@
 
 {% load staticfiles %}
 
-{% block nav_title %} Every single student {% endblock nav_title %}
+{% block nav_title %} But they've tried so hard... {% endblock nav_title %}
 
 {% block body_block %}
 
@@ -18,6 +18,7 @@
               <th>Task</th>
               <th>Student</th>
               <th>Score</th>
+              <th>Tutor</th>
               <th></th>
             </tr>
           </thead>
@@ -34,6 +35,11 @@
                 <code> no feedback </code>
                 {% endif %}
               </td>
+              <td class="align-middle">
+                {% if submission.feedback %}
+                  {{submission.feedback.of_tutor}}
+                {% endif %}
+              </td>
               <td class="align-middle fit">
                 {% if submission.feedback %}
                   {% if submission.feedback.origin == submission.feedback.WAS_EMPTY %}
diff --git a/core/templates/core/submission_view.html b/core/templates/core/submission_view.html
index e33a435b..40a4d19b 100644
--- a/core/templates/core/submission_view.html
+++ b/core/templates/core/submission_view.html
@@ -16,12 +16,22 @@
         <ul class="list-group list-group-flush">
           <li class="list-group-item"><strong class="mr-2">Submission Type: </strong> {{ submission.type }} </li>
           <li class="list-group-item"><strong class="mr-2">Student: </strong> {{ submission.student }}</li>
+          {% if feedback and is_reviewer %}
+          <li class="list-group-item">
+            <strong class="mr-2">Status: </strong> {% include "core/feedback_badge.html" %}
+            <span class="badge badge-warning ml-2">Only visible to reviewer</span>
+          </li>
+          <li class="list-group-item">
+            <strong class="mr-2">Tutor: </strong> {{ feedback.of_tutor }}
+            <span class="badge badge-warning ml-2">Only visible to reviewer</span>
+          </li>
+          {% endif %}
           <li class="list-group-item"><strong class="mr-2">Score: </strong>
             {% if feedback and feedback.status == feedback.ACCEPTED %}
             <code> {{ feedback.score }} / {{submission.type.full_score}} </code>
             {% elif feedback and is_reviewer %}
-              <code> {{ feedback.score }} / {{submission.type.full_score}} </code>
-              <span class="badge badge-warning ml-2">Only visible to reviewer</span>
+            <code> {{ feedback.score }} / {{submission.type.full_score}} </code>
+            <span class="badge badge-warning ml-2">Only visible to reviewer</span>
             {% else %}
             <span class="badge badge-danger">No Feedback</span>
             {% endif %}
@@ -30,10 +40,16 @@
       </div>
       <div class="card-footer">
         {% if is_reviewer %}
-            <a href="{% url 'create_feedback_for_submission' submission.slug %}" class="btn btn-success"> Create Feedback </a>
-            <a href="{% url 'submission_list' %}" class="btn btn-outline-success">Back</a>
+        <a href="{% url 'create_feedback_for_submission' submission.slug %}" class="btn btn-success">
+          {% if feedback %}
+          Edit Feedback
           {% else %}
-          <a href="{% url 'start' %}" class="btn btn-success">Back</a>
+          Create Feedback
+          {% endif %}
+        </a>
+        <a href="{% url 'submission_list' %}" class="btn btn-outline-success">Back</a>
+        {% else %}
+        <a href="{% url 'start' %}" class="btn btn-success">Back</a>
         {% endif %}
       </div>
     </div>
@@ -48,13 +64,17 @@
     </div>
   </div>
 
-  {% if submission.feedback and feedback.status == feedback.ACCEPTED or is_reviewer %}
+
+  {% if feedback %}
+  {% if feedback.status == feedback.ACCEPTED or is_reviewer %}
   <div class="col-4 my-4">
     <div class="card">
       <div class="card-block">
-        <div class="card-header">Our feedback {% if is_reviewer %}
+        <div class="card-header">Our feedback
+          {% if is_reviewer %}
           <span class="badge badge-warning ml-2">Only visible to reviewer</span>
-        {% endif %}</div>
+          {% endif %}
+        </div>
         <div class="editor-code" id="textarea_feedback">{{ feedback.text }}</div>
       </div>
     </div>
@@ -66,6 +86,7 @@
     })
   </script>
   {% endif %}
+  {% endif %}
 </div>
 {% endwith %}
 {% endblock body_block %}
diff --git a/core/views/user_startpages.py b/core/views/user_startpages.py
index 51506a37..83e81e4e 100644
--- a/core/views/user_startpages.py
+++ b/core/views/user_startpages.py
@@ -71,8 +71,8 @@ def student_view(request):
 def reviewer_view(request):
     context = {
         'submission_type_list': get_annotated_feedback_count(),
-        'tutor_list': User.objects.annotate(Count('corrected_submissions')).filter(groups__name='Tutors').order_by('-corrected_submissions'),
-        'submission_list': Submission.objects.all(),
+        'tutor_list': User.objects.annotate(Count('corrected_submissions')).filter(groups__name='Tutors')
+                                                                           .order_by('-corrected_submissions__count'),
         'feedback_list_manual': Feedback.objects.filter(origin=Feedback.MANUAL),
         'feedback_list_empty': Feedback.objects.filter(origin=Feedback.WAS_EMPTY),
         'feedback_list_did_not_compile': Feedback.objects.filter(origin=Feedback.DID_NOT_COMPILE),
-- 
GitLab