Skip to content

Commit b2f6a8b

Browse files
committed
Work on comments
1 parent 035554a commit b2f6a8b

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

src/commons/sagas/RequestsSaga.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ export const getGrading = async (
10561056
xpAdjustment: grade.xpAdjustment,
10571057
comments: grade.comments
10581058
},
1059-
ai_comments: gradingQuestion.ai_comments?.response.split('|||') || []
1059+
ai_comments: gradingQuestion.ai_comments?.response?.split('|||') || []
10601060
} as GradingQuestion;
10611061

10621062
if (gradingQuestion.grade.grader !== null) {
@@ -1559,8 +1559,8 @@ export const removeAssessmentConfig = async (
15591559
*/
15601560
export const postGenerateComments = async (
15611561
tokens: Tokens,
1562-
submission_id: integer,
1563-
question_id: integer
1562+
submission_id: number,
1563+
question_id: number
15641564
): Promise<{ comments: string[] } | null> => {
15651565
const resp = await request(
15661566
`${courseId()}/admin/generate-comments/${submission_id}/${question_id}`,
@@ -1578,8 +1578,8 @@ export const postGenerateComments = async (
15781578

15791579
export const saveFinalComment = async (
15801580
tokens: Tokens,
1581-
submission_id: integer,
1582-
question_id: integer,
1581+
submission_id: number,
1582+
question_id: number,
15831583
comment: string
15841584
): Promise<Response | null> => {
15851585
const resp = await request(

src/pages/academy/grading/subcomponents/GradingCommentSelector.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ const GradingCommentSelector: React.FC<Props> = props => {
1818
<div>
1919
{' '}
2020
{props.comments.length > 0 ? (
21-
props.comments.map(el => {
21+
props.comments.map((el, index) => {
2222
return (
23-
<div
23+
<button
24+
key={index}
2425
className="grading-comment-selector-item"
2526
onClick={() => {
2627
props.onSelect(el);
2728
}}
2829
>
2930
{el}
30-
</div>
31+
</button>
3132
);
3233
})
3334
) : (

src/pages/academy/grading/subcomponents/GradingEditor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ const GradingEditor: React.FC<Props> = props => {
167167
*/
168168
const validateXpBeforeSave =
169169
(handleSaving: GradingSaveFunction): (() => void) =>
170-
() => {
170+
async () => {
171171
const newXpAdjustmentInput = convertParamToInt(xpAdjustmentInput || undefined) || undefined;
172172
const xp = props.initialXp + (newXpAdjustmentInput || 0);
173-
postSaveFinalComment(editorValue);
173+
await postSaveFinalComment(editorValue);
174174
if (xp < 0 || xp > props.maxXp) {
175175
showWarningMessage(
176176
`XP ${xp.toString()} is out of bounds. Maximum xp is ${props.maxXp.toString()}.`

src/styles/_workspace.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,8 @@ $code-color-notification: #f9f0d7;
358358
}
359359

360360
.grading-comment-selector-item {
361-
margin: 4px;
362-
padding: 4px;
361+
margin: 3px;
362+
padding: 7px;
363363
background-color: $cadet-color-2;
364364
border: 1px solid $cadet-color-3;
365365
cursor: pointer;

0 commit comments

Comments
 (0)