Skip to content

Comments feature for grading #789

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Aug 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"react-dom": "^16.8.6",
"react-dom-factories": "^1.0.2",
"react-hotkeys": "^1.1.4",
"react-mde": "^5.6.0",
"react-mde": "^7.6.2",
"react-redux": "^5.1.0",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
Expand Down
55 changes: 51 additions & 4 deletions src/actions/__tests__/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
submitAnswer,
submitAssessment,
submitGrading,
submitGradingAndContinue,
unsubmitSubmission,
updateAssessment,
updateAssessmentOverviews,
Expand Down Expand Up @@ -195,7 +196,25 @@ test('submitGrading generates correct action object with default values', () =>
submissionId,
questionId,
gradeAdjustment: 0,
xpAdjustment: 0
xpAdjustment: 0,
comments: undefined
}
});
});

test('submitGradingAndContinue generates correct action object with default values', () => {
const submissionId = 8;
const questionId = 2;

const action = submitGradingAndContinue(submissionId, questionId);
expect(action).toEqual({
type: actionTypes.SUBMIT_GRADING_AND_CONTINUE,
payload: {
submissionId,
questionId,
gradeAdjustment: 0,
xpAdjustment: 0,
comments: undefined
}
});
});
Expand All @@ -205,14 +224,41 @@ test('submitGrading generates correct action object', () => {
const questionId = 3;
const gradeAdjustment = 10;
const xpAdjustment = 100;
const action = submitGrading(submissionId, questionId, gradeAdjustment, xpAdjustment);
const comments = 'my comment';
const action = submitGrading(submissionId, questionId, gradeAdjustment, xpAdjustment, comments);
expect(action).toEqual({
type: actionTypes.SUBMIT_GRADING,
payload: {
submissionId,
questionId,
gradeAdjustment,
xpAdjustment
xpAdjustment,
comments
}
});
});

test('submitGradingAndContinue generates correct action object', () => {
const submissionId = 4;
const questionId = 7;
const gradeAdjustment = 90;
const xpAdjustment = 55;
const comments = 'another comment';
const action = submitGradingAndContinue(
submissionId,
questionId,
gradeAdjustment,
xpAdjustment,
comments
);
expect(action).toEqual({
type: actionTypes.SUBMIT_GRADING_AND_CONTINUE,
payload: {
submissionId,
questionId,
gradeAdjustment,
xpAdjustment,
comments
}
});
});
Expand Down Expand Up @@ -329,7 +375,8 @@ test('updateGrading generates correct action object', () => {
grade: 10,
gradeAdjustment: 0,
xp: 100,
xpAdjustment: 0
xpAdjustment: 0,
comments: 'Well done.'
}
}
];
Expand Down
1 change: 1 addition & 0 deletions src/actions/actionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export const SET_USER = 'SET_USER';
export const SUBMIT_ANSWER = 'SUBMIT_ANSWER';
export const SUBMIT_ASSESSMENT = 'SUBMIT_ASSESSMENT';
export const SUBMIT_GRADING = 'SUBMIT_GRADING';
export const SUBMIT_GRADING_AND_CONTINUE = 'SUBMIT_GRADING_AND_CONTINUE';
export const UNSUBMIT_SUBMISSION = 'UNSUBMIT_SUBMISSION';
export const UPDATE_HISTORY_HELPERS = 'UPDATE_HISTORY_HELPERS';
export const UPDATE_ASSESSMENT_OVERVIEWS = 'UPDATE_ASSESSMENT_OVERVIEWS';
Expand Down
23 changes: 21 additions & 2 deletions src/actions/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,33 @@ export const submitGrading: ActionCreator<actionTypes.IAction> = (
submissionId: number,
questionId: number,
gradeAdjustment: number = 0,
xpAdjustment: number = 0
xpAdjustment: number = 0,
comments?: string
) => ({
type: actionTypes.SUBMIT_GRADING,
payload: {
submissionId,
questionId,
gradeAdjustment,
xpAdjustment
xpAdjustment,
comments
}
});

export const submitGradingAndContinue: ActionCreator<actionTypes.IAction> = (
submissionId: number,
questionId: number,
gradeAdjustment: number = 0,
xpAdjustment: number = 0,
comments?: string
) => ({
type: actionTypes.SUBMIT_GRADING_AND_CONTINUE,
payload: {
submissionId,
questionId,
gradeAdjustment,
xpAdjustment,
comments
}
});

Expand Down
Loading