Commit dbbb1bb08fbfebe8c9a058c8ebf05b7df6712a4f

Thomas de Grivel 2022-01-27T20:02:21

fix warnings

diff --git a/lib/kmxgit/organisation_manager.ex b/lib/kmxgit/organisation_manager.ex
index 9a94551..eaf78d4 100644
--- a/lib/kmxgit/organisation_manager.ex
+++ b/lib/kmxgit/organisation_manager.ex
@@ -72,7 +72,7 @@ defmodule Kmxgit.OrganisationManager do
   end
 
   def update_disk_usage() do
-    orgs = Repo.all(from org in Organisation, preload: :slug)
+    Repo.all(from org in Organisation, preload: :slug)
     |> Enum.map(fn org ->
       org
       |> Ecto.Changeset.cast(%{}, [])
diff --git a/lib/kmxgit/repository_manager.ex b/lib/kmxgit/repository_manager.ex
index cca598f..e73a062 100644
--- a/lib/kmxgit/repository_manager.ex
+++ b/lib/kmxgit/repository_manager.ex
@@ -115,8 +115,8 @@ defmodule Kmxgit.RepositoryManager do
   end
 
   def update_disk_usage() do
-    repos = Repo.all(from repo in Repository, preload: [organisation: :slug,
-                                                        user: :slug])
+    Repo.all(from repo in Repository, preload: [organisation: :slug,
+                                                user: :slug])
     |> Enum.map(fn repo ->
       repo
       |> Ecto.Changeset.cast(%{}, [])
diff --git a/lib/kmxgit/user_manager.ex b/lib/kmxgit/user_manager.ex
index 3581339..469d716 100644
--- a/lib/kmxgit/user_manager.ex
+++ b/lib/kmxgit/user_manager.ex
@@ -119,7 +119,7 @@ defmodule Kmxgit.UserManager do
   end
 
   def update_disk_usage() do
-    users = Repo.all(from user in User, preload: :slug)
+    Repo.all(from user in User, preload: :slug)
     |> Enum.map(fn user ->
       user
       |> Ecto.Changeset.cast(%{}, [])
diff --git a/lib/kmxgit_web/controllers/admin/organisation_controller.ex b/lib/kmxgit_web/controllers/admin/organisation_controller.ex
index 85f0300..d7d0512 100644
--- a/lib/kmxgit_web/controllers/admin/organisation_controller.ex
+++ b/lib/kmxgit_web/controllers/admin/organisation_controller.ex
@@ -15,26 +15,6 @@ defmodule KmxgitWeb.Admin.OrganisationController do
     |> render("index.html")
   end
 
-  defp sort_organisations(orgs, "id") do
-    orgs
-    |> Enum.sort(fn a, b -> a.id < b.id end)
-  end
-  defp sort_organisations(orgs, "name") do
-    orgs
-    |> Enum.sort_by(fn org ->
-      String.downcase(org.name || "")
-    end)
-  end
-  defp sort_organisations(orgs, "slug") do
-    orgs
-    |> Enum.sort(fn a, b -> String.downcase(a.slug.slug) < String.downcase(b.slug.slug) end)
-  end
-  defp sort_organisations(orgs, "du") do
-    orgs
-    |> Enum.sort(fn a, b -> a.disk_usage < b.disk_usage end)
-  end
-  defp sort_organisations(orgs, _), do: orgs
-
   def new(conn, _params) do
     changeset = OrganisationManager.change_organisation
     conn