diff --git a/priv/repo/seeds/accounts.exs b/priv/repo/seeds/accounts.exs index 544f0679c..dd6c763db 100644 --- a/priv/repo/seeds/accounts.exs +++ b/priv/repo/seeds/accounts.exs @@ -118,15 +118,16 @@ defmodule Atomic.Repo.Seeds.Accounts do "password" => "password1234", "role" => role, "course_id" => Enum.random(courses).id, - "default_organization_id" => Enum.random(organizations).id + "default_organization_id" => Enum.random(organizations).id, + "confirmed_at" => DateTime.utc_now() } case Accounts.register_user(user) do {:error, changeset} -> Mix.shell().error(Kernel.inspect(changeset.errors)) - {:ok, _} -> - :ok + {:ok, changeset} -> + Repo.update!(Accounts.User.confirm_changeset(changeset)) end end end diff --git a/priv/repo/seeds/activities.exs b/priv/repo/seeds/activities.exs index bbfa3ae36..02d139b36 100644 --- a/priv/repo/seeds/activities.exs +++ b/priv/repo/seeds/activities.exs @@ -4,6 +4,7 @@ defmodule Atomic.Repo.Seeds.Activities do alias Atomic.Accounts.User alias Atomic.Organizations.Department + alias Atomic.Activities alias Atomic.Activities.SessionDepartment alias Atomic.Activities.Session alias Atomic.Organizations.Organization @@ -211,14 +212,11 @@ defmodule Atomic.Repo.Seeds.Activities do case Repo.all(Enrollment) do [] -> for user <- Repo.all(User) do - for _ <- 1..Enum.random(1..3) do - %Enrollment{} - |> Enrollment.changeset(%{ - user_id: user.id, - session_id: Enum.random(sessions).id, - present: Enum.random([true, false]) - }) - |> Repo.insert!() + for _ <- 1..Enum.random(1..2) do + Activities.create_enrollment( + Enum.random(sessions).id, + user + ) end end end