Skip to content

Commit

Permalink
Merge branch 'master' into feat-calculate-all-user-xp
Browse files Browse the repository at this point in the history
  • Loading branch information
RichDom2185 authored Sep 3, 2023
2 parents cbf3e08 + dfcbdb4 commit 7f82b5a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
2 changes: 2 additions & 0 deletions lib/cadet/assessments/assessments.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1224,6 +1224,7 @@ defmodule Cadet.Assessments do
(select
a.id,
a.title,
a.number as "assessmentNumber",
bool_or(ac.is_manually_graded) as "isManuallyGraded",
max(ac.type) as "type",
sum(q.max_xp) as "maxXp",
Expand All @@ -1242,6 +1243,7 @@ defmodule Cadet.Assessments do
(select
cr.id,
u.name as "name",
u.username as "username",
g.name as "groupName",
g.leader_id as "groupLeaderId"
from course_registrations cr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ defmodule CadetWeb.AdminGradingController do
properties do
id(:integer, "student id", required: true)
name(:string, "student name", required: true)
username(:string, "student username", required: true)
groupName(:string, "name of student's group")
groupLeaderId(:integer, "user id of group leader")
end
Expand Down
6 changes: 5 additions & 1 deletion lib/cadet_web/admin_views/admin_grading_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ defmodule CadetWeb.AdminGradingView do
def render("grading_info.json", %{answer: answer}) do
transform_map_for_view(answer, %{
student:
&transform_map_for_view(&1.submission.student, %{name: fn st -> st.user.name end, id: :id}),
&transform_map_for_view(&1.submission.student, %{
name: fn st -> st.user.name end,
id: :id,
username: fn st -> st.user.username end
}),
question: &build_grading_question/1,
solution: &(&1.question.question["solution"] || ""),
grade: &build_grade/1
Expand Down
Loading

0 comments on commit 7f82b5a

Please sign in to comment.