sort clothes

This commit is contained in:
Lili (Tlapka) 2021-09-29 16:01:15 +02:00
parent c732621ae4
commit 06f7ec47f1
1 changed files with 4 additions and 1 deletions

View File

@ -31,6 +31,9 @@ defmodule PokemonCoutureWeb.ClothesTrackerLive do
def inner_map_creator({type, list}, acc) do def inner_map_creator({type, list}, acc) do
clothes_map = Enum.reduce(list, %{}, &assign_clothespiece_to_map/2) clothes_map = Enum.reduce(list, %{}, &assign_clothespiece_to_map/2)
clothes_map = for {shop, map} <- clothes_map
do {shop, Enum.sort_by(map, fn %Clothes{game: game} -> game end)}
end
Map.put(acc, type, clothes_map) Map.put(acc, type, clothes_map)
end end