From 192d1160cd0f98fb9c2be91df9ab154bae371ce5 Mon Sep 17 00:00:00 2001 From: "robinwilliam.hundt" <robinwilliam.hundt@stud.uni-goettingen.de> Date: Thu, 3 Jan 2019 14:07:49 +0100 Subject: [PATCH] Fixed two small bugs 1. Error is assignment list view causing 500 response 2. fixed error handling in feedback creation --- core/views/subscription.py | 2 +- frontend/src/store/modules/submission-notes.ts | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/core/views/subscription.py b/core/views/subscription.py index 88dc1d3e..266bd647 100644 --- a/core/views/subscription.py +++ b/core/views/subscription.py @@ -97,7 +97,7 @@ class AssignmentApiViewSet( @permission_classes((IsReviewer,)) def list(self, *args, **kwargs): - super().list(*args, **kwargs) + return super().list(*args, **kwargs) @action(detail=False, permission_classes=(IsReviewer,), methods=['get', 'delete']) def active(self, request): diff --git a/frontend/src/store/modules/submission-notes.ts b/frontend/src/store/modules/submission-notes.ts index 3c1f1376..b34a6d71 100644 --- a/frontend/src/store/modules/submission-notes.ts +++ b/frontend/src/store/modules/submission-notes.ts @@ -1,14 +1,10 @@ import Vue from 'vue' import * as hljs from 'highlight.js' import * as api from '@/api' -import { nameSpacer } from '@/util/helpers' -import { Feedback, FeedbackComment, Submission, SubmissionNoType } from '@/models' +import { Feedback, FeedbackComment, SubmissionNoType } from '@/models' import { RootState } from '@/store/store' -import { Module } from 'vuex' import { getStoreBuilder, BareActionContext } from 'vuex-typex' -export const subNotesNamespace = nameSpacer('submissionNotes/') - export interface SubmissionNotesState { submission: SubmissionNoType ui: { @@ -143,13 +139,16 @@ async function submitFeedback ({ state }: BareActionContext<SubmissionNotesState } if (state.origFeedback.score === undefined && state.updatedFeedback.score === undefined) { throw new Error('You need to give a score.') + } else if (state.updatedFeedback.score !== undefined) { + feedback.score = state.updatedFeedback.score } else { - feedback.score = state.updatedFeedback.score || state.origFeedback.score || 0 + feedback.score = state.origFeedback.score } + if (Object.keys(state.updatedFeedback.feedbackLines || {}).length > 0) { feedback.feedbackLines = state.updatedFeedback.feedbackLines } else if (feedback.score! < SubmissionNotes.submissionType.fullScore!) { - throw new Error('You need to provide a reason for a reduced score.') + throw new Error('You need to add or change a comment when setting a non full score.') } // delete those comments that have been marked for deletion await SubmissionNotes.deleteComments() -- GitLab