Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #7 from 3n3a/dev
Browse files Browse the repository at this point in the history
BugFix: Subject field missing in Exam Endpoint
  • Loading branch information
3n3a authored Aug 24, 2022
2 parents 1ea2a37 + fc93dc1 commit 49a0f23
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ defmodule ManagerApi.ExamView do
use ManagerApi, :view
alias ManagerApi.ExamView

alias Manager.School


def get_subject_name(exam) do
School.get_subject!(exam.subject_id).name
end

def render("index.json", %{exams: exams}) do
%{data: render_many(exams, ExamView, "exam.json")}
end
Expand All @@ -16,6 +23,7 @@ defmodule ManagerApi.ExamView do
name: exam.name,
mark: exam.mark,
type: exam.type,
subject: get_subject_name(exam)
status: exam.status
}
end
Expand Down

0 comments on commit 49a0f23

Please sign in to comment.