Skip to content
Snippets Groups Projects
Commit 192d1160 authored by robinwilliam.hundt's avatar robinwilliam.hundt
Browse files

Fixed two small bugs

1. Error is assignment list view causing 500 response
2. fixed error handling in feedback creation
parent 9f99d0f5
No related branches found
No related tags found
No related merge requests found
Pipeline #86634 failed
...@@ -97,7 +97,7 @@ class AssignmentApiViewSet( ...@@ -97,7 +97,7 @@ class AssignmentApiViewSet(
@permission_classes((IsReviewer,)) @permission_classes((IsReviewer,))
def list(self, *args, **kwargs): def list(self, *args, **kwargs):
super().list(*args, **kwargs) return super().list(*args, **kwargs)
@action(detail=False, permission_classes=(IsReviewer,), methods=['get', 'delete']) @action(detail=False, permission_classes=(IsReviewer,), methods=['get', 'delete'])
def active(self, request): def active(self, request):
......
import Vue from 'vue' import Vue from 'vue'
import * as hljs from 'highlight.js' import * as hljs from 'highlight.js'
import * as api from '@/api' import * as api from '@/api'
import { nameSpacer } from '@/util/helpers' import { Feedback, FeedbackComment, SubmissionNoType } from '@/models'
import { Feedback, FeedbackComment, Submission, SubmissionNoType } from '@/models'
import { RootState } from '@/store/store' import { RootState } from '@/store/store'
import { Module } from 'vuex'
import { getStoreBuilder, BareActionContext } from 'vuex-typex' import { getStoreBuilder, BareActionContext } from 'vuex-typex'
export const subNotesNamespace = nameSpacer('submissionNotes/')
export interface SubmissionNotesState { export interface SubmissionNotesState {
submission: SubmissionNoType submission: SubmissionNoType
ui: { ui: {
...@@ -143,13 +139,16 @@ async function submitFeedback ({ state }: BareActionContext<SubmissionNotesState ...@@ -143,13 +139,16 @@ async function submitFeedback ({ state }: BareActionContext<SubmissionNotesState
} }
if (state.origFeedback.score === undefined && state.updatedFeedback.score === undefined) { if (state.origFeedback.score === undefined && state.updatedFeedback.score === undefined) {
throw new Error('You need to give a score.') throw new Error('You need to give a score.')
} else if (state.updatedFeedback.score !== undefined) {
feedback.score = state.updatedFeedback.score
} else { } else {
feedback.score = state.updatedFeedback.score || state.origFeedback.score || 0 feedback.score = state.origFeedback.score
} }
if (Object.keys(state.updatedFeedback.feedbackLines || {}).length > 0) { if (Object.keys(state.updatedFeedback.feedbackLines || {}).length > 0) {
feedback.feedbackLines = state.updatedFeedback.feedbackLines feedback.feedbackLines = state.updatedFeedback.feedbackLines
} else if (feedback.score! < SubmissionNotes.submissionType.fullScore!) { } 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 // delete those comments that have been marked for deletion
await SubmissionNotes.deleteComments() await SubmissionNotes.deleteComments()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment