Skip to content

Commit

Permalink
Fix create lti quiz only when needed
Browse files Browse the repository at this point in the history
  • Loading branch information
alxlion committed Dec 23, 2024
1 parent aba07c1 commit a2227d0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/claper/quizzes.ex
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ defmodule Claper.Quizzes do
|> Repo.insert()
|> case do
{:ok, quiz} ->
Claper.Workers.QuizLti.create(quiz.id) |> Oban.insert()
if attrs["lti_resource_id"] do
Claper.Workers.QuizLti.create(quiz.id) |> Oban.insert()
end

{:ok, quiz}

error ->
Expand Down Expand Up @@ -141,7 +144,9 @@ defmodule Claper.Quizzes do
|> Repo.update()
|> case do
{:ok, updated_quiz} ->
Claper.Workers.QuizLti.edit(updated_quiz.id) |> Oban.insert()
if quiz.lti_resource_id do
Claper.Workers.QuizLti.edit(quiz.id) |> Oban.insert()
end
broadcast({:ok, updated_quiz, event_uuid}, :quiz_updated)

error ->
Expand Down

0 comments on commit a2227d0

Please sign in to comment.