Skip to content

Commit b7fccdb

Browse files
authored
Fix comment not being submitted (#325)
* Rename GradingEditor prop (comments -> comment) * Rename dispatch prop argument (comments -> comment) * Remove grade from action * Remove "grade" prop usage in mock backend saga * Fix wrong id being passed to grading editor
1 parent f158d13 commit b7fccdb

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

src/actions/session.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ export const submitAssessment: ActionCreator<actionTypes.IAction> = (id: number)
7575
export const submitGrading: ActionCreator<actionTypes.IAction> = (
7676
submissionId: number,
7777
questionId: number,
78-
grade: number,
7978
comment: string,
8079
adjustment: number = 0
8180
) => ({

src/components/academy/grading/GradingEditor.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ export type DispatchProps = {
1515
handleGradingSave: (
1616
submissionId: number,
1717
questionId: number,
18-
comments: string,
18+
comment: string,
1919
adjustment: number | undefined
2020
) => void
2121
}
2222

2323
export type OwnProps = {
2424
adjustment: number
25-
comments: string
25+
comment: string
2626
initialGrade: number
2727
maximumGrade: number
2828
questionId: number
@@ -49,7 +49,7 @@ class GradingEditor extends React.Component<GradingEditorProps, State> {
4949
super(props)
5050
this.state = {
5151
mdeState: {
52-
markdown: props.comments
52+
markdown: props.comment
5353
},
5454
adjustmentInput: props.adjustment.toString()
5555
}
@@ -185,7 +185,7 @@ class GradingEditor extends React.Component<GradingEditorProps, State> {
185185
private hasUnsavedChanges = () => {
186186
const adjustmentInput = stringParamToInt(this.state.adjustmentInput || undefined)
187187
return (
188-
this.props.comments !== this.state.mdeState.markdown ||
188+
this.props.comment !== this.state.mdeState.markdown ||
189189
this.props.adjustment !== adjustmentInput
190190
)
191191
}

src/components/academy/grading/GradingWorkspace.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ class GradingWorkspace extends React.Component<GradingWorkspaceProps> {
185185
body: (
186186
<GradingEditor
187187
adjustment={props.grading![questionId].grade.adjustment}
188-
comments={props.grading![questionId].grade.comment}
188+
comment={props.grading![questionId].grade.comment}
189189
initialGrade={props.grading![questionId].grade.grade}
190190
maximumGrade={props.grading![questionId].maximumGrade}
191-
questionId={questionId}
191+
questionId={props.grading![questionId].question.id}
192192
submissionId={props.submissionId}
193193
/>
194194
)

src/mocks/backend.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export function* mockBackendSaga(): SagaIterator {
8585
const {
8686
submissionId,
8787
questionId,
88-
grade,
8988
comment,
9089
adjustment
9190
} = (action as actionTypes.IAction).payload
@@ -98,7 +97,7 @@ export function* mockBackendSaga(): SagaIterator {
9897
gradingQuestion.grade = {
9998
adjustment,
10099
comment,
101-
grade
100+
grade: gradingQuestion.grade.grade
102101
}
103102
}
104103
return gradingQuestion

0 commit comments

Comments
 (0)