From 5ba3ed772555c21ecb79478a1cc239ffdd1e46f5 Mon Sep 17 00:00:00 2001
From: "robinwilliam.hundt" <robinwilliam.hundt@stud.uni-goettingen.de>
Date: Sun, 11 Mar 2018 20:22:44 +0100
Subject: [PATCH] Cleaned up StudentViews / Added test output

closes #91
---
 .../components/student/ExamInformation.vue    |  2 +-
 .../student/NonFinalFeedbackAlert.vue         | 23 +++++++++++
 .../src/components/student/SubmissionList.vue | 13 +++++-
 frontend/src/pages/student/StudentLayout.vue  |  7 +---
 .../pages/student/StudentSubmissionPage.vue   | 40 ++++++++++++-------
 5 files changed, 63 insertions(+), 22 deletions(-)
 create mode 100644 frontend/src/components/student/NonFinalFeedbackAlert.vue

diff --git a/frontend/src/components/student/ExamInformation.vue b/frontend/src/components/student/ExamInformation.vue
index 21795f05..6ebcf482 100644
--- a/frontend/src/components/student/ExamInformation.vue
+++ b/frontend/src/components/student/ExamInformation.vue
@@ -2,7 +2,7 @@
   <table class="table table-info rounded">
     <tbody>
       <tr>
-        <th>Modul</th>
+        <th>Module</th>
         <td>{{ exam.module_reference }}</td>
       </tr>
       <tr>
diff --git a/frontend/src/components/student/NonFinalFeedbackAlert.vue b/frontend/src/components/student/NonFinalFeedbackAlert.vue
new file mode 100644
index 00000000..801c2204
--- /dev/null
+++ b/frontend/src/components/student/NonFinalFeedbackAlert.vue
@@ -0,0 +1,23 @@
+<template>
+    <v-alert type="warning" :value="value" class="non-final-alert ">
+      This feedback is not final! Changes will likely occur!
+    </v-alert>
+</template>
+
+<script>
+  export default {
+    name: 'non-final-feedback-alert',
+    props: {
+      value: {
+        type: Boolean,
+        default: true
+      }
+    }
+  }
+</script>
+
+<style scoped>
+  .non-final-alert {
+    font-weight: bolder;
+  }
+</style>
diff --git a/frontend/src/components/student/SubmissionList.vue b/frontend/src/components/student/SubmissionList.vue
index 916563d5..1c624da3 100644
--- a/frontend/src/components/student/SubmissionList.vue
+++ b/frontend/src/components/student/SubmissionList.vue
@@ -10,7 +10,11 @@
         <td>{{ props.item.type.name }}</td>
         <td class="text-xs-right">{{ props.item.feedback.score }}</td>
         <td class="text-xs-right">{{ props.item.type.full_score }}</td>
-        <td class="text-xs-right"><v-btn :to="`/student/submission/${props.item.type.pk}`" color="orange lighten-2"><v-icon>chevron_right</v-icon></v-btn></td>
+        <td class="text-xs-right">
+          <v-btn :to="`/submission/${props.item.type.pk}`" color="orange lighten-2">
+            <v-icon>chevron_right</v-icon>
+          </v-btn>
+        </td>
       </template>
     </v-data-table>
     <v-alert color="info" value="true">
@@ -34,11 +38,18 @@
           },
           {
             text: 'Score',
+            align: 'right',
             value: 'feedback.score'
           },
           {
             text: 'Maximum Score',
+            align: 'right',
             value: 'type.full_score'
+          },
+          {
+            text: 'View',
+            align: 'center',
+            sortable: false
           }
         ]
       }
diff --git a/frontend/src/pages/student/StudentLayout.vue b/frontend/src/pages/student/StudentLayout.vue
index c3100896..02e351af 100644
--- a/frontend/src/pages/student/StudentLayout.vue
+++ b/frontend/src/pages/student/StudentLayout.vue
@@ -25,7 +25,7 @@
               v-if="!mini"
               class="elevation-1 exam-info ma-1"
             />
-      <v-list-tile exact v-for="(item, i) in submissionNavItems" :key="i" :to="item.route">
+      <v-list-tile exact v-for="item in submissionNavItems" :key="item.route" :to="item.route">
         <v-list-tile-action>
           <v-icon v-if="!visited[item.id]">assignment</v-icon>
           <v-icon v-else>check</v-icon>
@@ -54,11 +54,6 @@
             name: 'Overview',
             icon: 'home',
             route: '/home'
-          },
-          {
-            name: 'Statistics',
-            icon: 'show_chart',
-            route: '/home'
           }
         ]
       }
diff --git a/frontend/src/pages/student/StudentSubmissionPage.vue b/frontend/src/pages/student/StudentSubmissionPage.vue
index b751e545..80f6e312 100644
--- a/frontend/src/pages/student/StudentSubmissionPage.vue
+++ b/frontend/src/pages/student/StudentSubmissionPage.vue
@@ -1,5 +1,6 @@
 <template>
   <v-container flex>
+    <non-final-feedback-alert :value="!feedbackIsFinal"/>
     <v-layout row wrap>
       <v-flex lg6 md12 mt-5>
         <base-annotated-submission>
@@ -19,18 +20,25 @@
           </v-toolbar>
           <template slot="table-content">
             <tr v-for="(code, lineNo) in submission" :key="lineNo">
-              <submission-line :code="code" :lineNo="lineNo"/>
-              <feedback-comment
-                v-if="feedback[lineNo] && showFeedback"
-                v-for="(comment, index) in feedback[lineNo]"
-                v-bind="comment"
-                :key="index"
-              />
+              <submission-line :code="code" :lineNo="lineNo">
+                <feedback-comment
+                  v-if="feedback[lineNo] && showFeedback"
+                  v-for="(comment, index) in feedback[lineNo]"
+                  v-bind="comment"
+                  :line-no="lineNo"
+                  :key="index"
+                />
+              </submission-line>
             </tr>
           </template>
         </base-annotated-submission>
+        <submission-tests
+          :tests="submission.tests"
+          :expand="true"
+          class="mt-3"
+        ></submission-tests>
       </v-flex>
-      <v-flex lg6 md12>
+      <v-flex lg6 md12 mt-5 pl-3>
         <submission-type
         v-bind="submissionType">
         </submission-type>
@@ -49,10 +57,14 @@
   import FeedbackComment from '@/components/submission_notes/base/FeedbackComment'
   import {studentPageMut} from '@/store/modules/student-page'
   import {subNotesMut} from '@/store/modules/submission-notes'
+  import SubmissionTests from '@/components/SubmissionTests'
+  import NonFinalFeedbackAlert from '@/components/student/NonFinalFeedbackAlert'
 
   export default {
     name: 'student-submission-page',
     components: {
+      NonFinalFeedbackAlert,
+      SubmissionTests,
       FeedbackComment,
       SubmissionLine,
       BaseAnnotatedSubmission,
@@ -71,10 +83,13 @@
         'submission'
       ]),
       ...mapState({
-        score: function (state) { return state.studentPage.submissionData[this.id].feedback.score },
-        submissionType: function (state) { return state.studentPage.submissionData[this.id].type },
-        feedback: function (state) {
+        score (state) { return state.studentPage.submissionData[this.id].feedback.score },
+        submissionType (state) { return state.studentPage.submissionData[this.id].type },
+        feedback (state) {
           return state.studentPage.submissionData[this.$route.params.id].feedback.feedback_lines
+        },
+        feedbackIsFinal (state) {
+          return state.studentPage.submissionData[this.$route.params.id].feedback.is_final
         }
       })
     },
@@ -87,9 +102,6 @@
     },
     mounted () {
       this.onRouteMountOrUpdate(this.id)
-      this.$nextTick(() => {
-        window.PR.prettyPrint()
-      })
     },
     beforeRouteUpdate (to, from, next) {
       this.onRouteMountOrUpdate(to.params.id)
-- 
GitLab