kerasus 2 лет назад
Родитель
Сommit
418d331a8c

+ 18 - 0
src/api/models/AnswerBook.js

@@ -9,6 +9,7 @@ export default class AnswerBookAPI extends APIRepository {
       base: '/lma/answer_books',
       getOrCreate: '/lma/answer_books/get_or_create',
       byId: (id) => '/lma/answer_books/' + id,
+      submitGraderDescription: (id) => '/lma/answer_books/' + id + '/submit_grader_description',
       confirmAnswers: (id) => '/lma/answer_books/' + id + '/confirm_answers',
       confirmScores: (id) => '/lma/answer_books/' + id + '/confirm_scores',
       confirmUngradable: (id) => '/lma/answer_books/' + id + '/confirm_ungradable',
@@ -113,6 +114,23 @@ export default class AnswerBookAPI extends APIRepository {
     })
   }
 
+  submitGraderDescription (id, graderDescription) {
+    return this.sendRequest({
+      apiMethod: 'put',
+      api: this.api,
+      request: this.APIAdresses.submitGraderDescription(id),
+      data: {
+        grader_description: graderDescription
+      },
+      resolveCallback: (response) => {
+        return new AnswerBook(response.data)
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
+
   confirmAnswers (id) {
     return this.sendRequest({
       apiMethod: 'put',

+ 25 - 1
src/components/Widgets/Test/ShowTestGradeForGrader/ShowTestGradeForGrader.vue

@@ -148,6 +148,18 @@
         </div>
         <div v-html="answerBook.objection_result" />
       </template>
+      <q-banner v-if="currentUserIsGrader && answerBook.status === 'GRADING'">
+        <q-input v-model="answerBook.grader_description"
+                 type="textarea"
+                 label="توضیحات مصحح"
+                 :loading="graderDescriptionLoading" />
+        <q-btn color="primary"
+               label="ثبت توضیحات مصحح"
+               outline
+               class="full-width"
+               :loading="graderDescriptionLoading"
+               @click="submitGraderDescription" />
+      </q-banner>
       <q-card-actions v-if="answerBook.status === 'GRADING'">
         <q-btn color="primary"
                class="q-mr-lg"
@@ -180,9 +192,10 @@ export default {
   data () {
     return {
       mounted: false,
+      graderDescriptionLoading: false,
       currentUserIsGrader: false,
       overallAnswerInput: [
-        { type: 'input', name: 'overall_answer_text', responseKey: 'overall_answer_text', label: 'متن پاسخ جامع', placeholder: ' ', inputType: 'textarea', col: 'col-12' },
+        // { type: 'input', name: 'overall_answer_text', responseKey: 'overall_answer_text', label: 'متن پاسخ جامع', placeholder: ' ', inputType: 'textarea', col: 'col-12' },
         { type: 'file', name: 'overall_answer_attachment', responseKey: 'overall_answer_attachment', label: 'فایل پیوست جامع', placeholder: ' ', col: 'col-12' }
       ],
       questionInput: [
@@ -255,6 +268,17 @@ export default {
           this.answerBook.loading = false
         })
     },
+    submitGraderDescription () {
+      this.graderDescriptionLoading = true
+      APIGateway.answerBook.submitGraderDescription(this.answerBook.id, this.answerBook.grader_description)
+        .then(() => {
+          this.graderDescriptionLoading = false
+          this.getAnswerBook()
+        })
+        .catch(() => {
+          this.graderDescriptionLoading = false
+        })
+    },
     submitScore (index) {
       this.scores[index].loading = true
       APIGateway.answerSheet.submitScore(this.answerBook.answer_sheet_info.list[index].id, this.scores[index].score)