select users correctly

This commit is contained in:
byte[] 2019-11-29 17:04:59 -05:00
parent c047f0af6d
commit 6e6d08f098

View file

@ -12,12 +12,12 @@ defmodule PhilomenaWeb.StaffController do
|> order_by(asc: :name) |> order_by(asc: :name)
|> Repo.all() |> Repo.all()
categories = %{ categories = [
"Administrators" => Enum.filter(users, & &1.role == "admin"), "Administrators": Enum.filter(users, & &1.role == "admin"),
"Technical Team" => Enum.filter(users, & &1.role != "admin" and &1.secondary_role not in [nil, ""]), "Technical Team": Enum.filter(users, & &1.role != "admin" and &1.secondary_role not in [nil, ""]),
"Moderators" => Enum.filter(users, & &1.role != "admin" and &1.secondary_role in [nil, ""]), "Moderators": Enum.filter(users, & &1.role == "moderator" and &1.secondary_role in [nil, ""]),
"Assistants" => Enum.filter(users, & &1.role == "assistant" and &1.secondary_role in [nil, ""]) "Assistants": Enum.filter(users, & &1.role == "assistant" and &1.secondary_role in [nil, ""])
} ]
render(conn, "index.html", categories: categories) render(conn, "index.html", categories: categories)
end end