Skip to content
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
9 changes: 8 additions & 1 deletion lib/cadet_web/controllers/grading_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ defmodule CadetWeb.GradingController do
GradingInfo:
swagger_schema do
description(
"A list of questions with submitted answers and previous grading info if available"
"A list of questions with submitted answers, solution and previous grading info " <>
"if available"
)

type(:array)
Expand All @@ -171,6 +172,12 @@ defmodule CadetWeb.GradingController do
question(Schema.ref(:Question))
grade(Schema.ref(:Grade))

solution(
:string,
"the marking scheme and model solution to this question. Only available for programming questions",
required: true
)

maxGrade(
:integer,
"the max grade that can be given to this question",
Expand Down
1 change: 1 addition & 0 deletions lib/cadet_web/views/grading_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ defmodule CadetWeb.GradingView do
&1.answer["code"] || &1.answer["choice_id"]
),
maxGrade: & &1.question.max_grade,
solution: &(&1.question.question["solution"] || ""),
grade: &transform_map_for_view(&1, [:grade, :adjustment, :comment])
})
end
Expand Down
2 changes: 2 additions & 0 deletions test/cadet_web/controllers/grading_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ defmodule CadetWeb.GradingControllerTest do
"content" => &1.question.question.content,
"answer" => &1.answer.code
},
"solution" => &1.question.question.solution,
"maxGrade" => &1.question.max_grade,
"grade" => %{
"grade" => &1.grade,
Expand Down Expand Up @@ -176,6 +177,7 @@ defmodule CadetWeb.GradingControllerTest do
}
end
},
"solution" => "",
"maxGrade" => &1.question.max_grade,
"grade" => %{
"grade" => &1.grade,
Expand Down