mirror of
https://github.com/kieraneglin/pinchflat.git
synced 2026-01-23 02:24:24 +00:00
Made source sorting case-insensitive
This commit is contained in:
parent
a55f17ac5f
commit
535ef3bb71
2 changed files with 12 additions and 2 deletions
|
|
@ -54,8 +54,8 @@ defmodule PinchflatWeb.Sources.SourceLive.IndexTableLive do
|
|||
defp sort_attr(:pending_count), do: dynamic([s, mp, dl, pe], pe.pending_count)
|
||||
defp sort_attr(:downloaded_count), do: dynamic([s, mp, dl], dl.downloaded_count)
|
||||
defp sort_attr(:media_size_bytes), do: dynamic([s, mp, dl], dl.media_size_bytes)
|
||||
defp sort_attr(:media_profile_name), do: dynamic([s, mp], mp.name)
|
||||
defp sort_attr(:custom_name), do: dynamic([s], s.custom_name)
|
||||
defp sort_attr(:media_profile_name), do: dynamic([s, mp], fragment("? COLLATE NOCASE", mp.name))
|
||||
defp sort_attr(:custom_name), do: dynamic([s], fragment("? COLLATE NOCASE", s.custom_name))
|
||||
defp sort_attr(:enabled), do: dynamic([s], s.enabled)
|
||||
|
||||
defp set_sources(%{assigns: assigns} = socket) do
|
||||
|
|
|
|||
|
|
@ -75,6 +75,16 @@ defmodule PinchflatWeb.Sources.SourceLive.IndexTableLiveTest do
|
|||
assert render_element(view, "tbody tr:first-child") =~ source1.custom_name
|
||||
assert render_element(view, "tbody tr:last-child") =~ source2.custom_name
|
||||
end
|
||||
|
||||
test "name is sorted without case sensitivity", %{conn: conn} do
|
||||
source1 = source_fixture(custom_name: "Source_B")
|
||||
source2 = source_fixture(custom_name: "source_a")
|
||||
|
||||
{:ok, view, _html} = live_isolated(conn, IndexTableLive, session: create_session())
|
||||
|
||||
assert render_element(view, "tbody tr:first-child") =~ source2.custom_name
|
||||
assert render_element(view, "tbody tr:last-child") =~ source1.custom_name
|
||||
end
|
||||
end
|
||||
|
||||
describe "when testing pagination" do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue