Skip to content

Fix status code #957

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 3 commits into from
Jun 30, 2023
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
2 changes: 1 addition & 1 deletion .credo.exs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
{Credo.Check.Refactor.MatchInCondition},
{Credo.Check.Refactor.NegatedConditionsInUnless},
{Credo.Check.Refactor.NegatedConditionsWithElse},
{Credo.Check.Refactor.Nesting},
{Credo.Check.Refactor.Nesting, max_nesting: 5},
{Credo.Check.Refactor.PipeChainStart},
{Credo.Check.Refactor.UnlessWithElse},
{Credo.Check.Warning.BoolOperationOnSameValues},
Expand Down
10 changes: 5 additions & 5 deletions lib/cadet/assessments/assessments.ex
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ defmodule Cadet.Assessments do
assessment = assessment |> Map.put(:questions, questions)
{:ok, assessment}
else
{:error, {:unauthorized, "Assessment not open"}}
{:error, {:forbidden, "Assessment not open"}}
end
end

Expand Down Expand Up @@ -1158,7 +1158,7 @@ defmodule Cadet.Assessments do
a boolean which is false by default.

The return value is {:ok, submissions} if no errors, else it is {:error,
{:unauthorized, "Forbidden."}}
{:forbidden, "Forbidden."}}
"""
@spec all_submissions_by_grader_for_index(CourseRegistration.t()) ::
{:ok, String.t()}
Expand Down Expand Up @@ -1270,7 +1270,7 @@ defmodule Cadet.Assessments do
end

@spec get_answers_in_submission(integer() | String.t()) ::
{:ok, [Answer.t()]} | {:error, {:bad_request | :unauthorized, String.t()}}
{:ok, [Answer.t()]} | {:error, {:bad_request, String.t()}}
def get_answers_in_submission(id) when is_ecto_id(id) do
answer_query =
Answer
Expand Down Expand Up @@ -1338,7 +1338,7 @@ defmodule Cadet.Assessments do
CourseRegistration.t()
) ::
{:ok, nil}
| {:error, {:unauthorized | :bad_request | :internal_server_error, String.t()}}
| {:error, {:forbidden | :bad_request | :internal_server_error, String.t()}}
def update_grading_info(
%{submission_id: submission_id, question_id: question_id},
attrs,
Expand Down Expand Up @@ -1393,7 +1393,7 @@ defmodule Cadet.Assessments do
_,
_
) do
{:error, {:unauthorized, "User is not permitted to grade."}}
{:error, {:forbidden, "User is not permitted to grade."}}
end

@spec force_regrade_submission(integer() | String.t(), CourseRegistration.t()) ::
Expand Down
3 changes: 2 additions & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Cadet.Mixfile do
version: "0.0.1",
elixir: "~> 1.10",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: [:phoenix, :gettext] ++ Mix.compilers() ++ [:phoenix_swagger],
compilers: Mix.compilers() ++ [:phoenix_swagger],
start_permanent: Mix.env() == :prod,
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
Expand Down Expand Up @@ -70,6 +70,7 @@ defmodule Cadet.Mixfile do
{:jason, "~> 1.2"},
{:openid_connect, "~> 0.2"},
{:phoenix, "~> 1.5"},
{:phoenix_view, "~> 2.0"},
{:phoenix_ecto, "~> 4.0"},
{:phoenix_swagger, "~> 0.8"},
{:plug_cowboy, "~> 2.0"},
Expand Down
Loading