Skip to content

Commit b7dda28

Browse files
committed
Seperated nil checks to be for indivudual field instead
1 parent 957e91b commit b7dda28

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/cadet_web/admin_controllers/admin_assessments_controller.ex

+7-2
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,14 @@ defmodule CadetWeb.AdminAssessmentsController do
104104
if is_nil(has_token_counter) do
105105
updated_assessment
106106
else
107+
Map.put(updated_assessment, :has_token_counter, has_token_counter)
108+
end
109+
110+
updated_assessment =
111+
if is_nil(has_voting_features) do
107112
updated_assessment
108-
|> Map.put(:has_token_counter, has_token_counter)
109-
|> Map.put(:has_voting_features, has_voting_features)
113+
else
114+
Map.put(updated_assessment, :has_voting_features, has_voting_features)
110115
end
111116

112117
with {:ok, assessment} <- check_dates(open_at, close_at, updated_assessment),

0 commit comments

Comments
 (0)