From 8176884124a2b19e548fba83e10bc860d1e5f637 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Sun, 4 Oct 2020 23:13:38 +0200 Subject: [PATCH] Fix sort videos --- src/Twitch.elm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Twitch.elm b/src/Twitch.elm index 2af19ea..0d60b16 100644 --- a/src/Twitch.elm +++ b/src/Twitch.elm @@ -77,14 +77,14 @@ videoMiniatureUrl video = video.url ++ "miniature-050.png" -sortPlaylist : Playlist -> Playlist -sortPlaylist playlist = - { playlist | videos = List.sort playlist.videos |> List.reverse } +sortPlaylistWithVideos : PlaylistWithVideos -> PlaylistWithVideos +sortPlaylistWithVideos playlist = + { playlist | videos = List.sortBy .url playlist.videos |> List.reverse } sortPlaylists : List Playlist -> List Playlist sortPlaylists playlists = - List.sortBy .url (List.map sortPlaylist playlists) |> List.reverse + List.sortBy .url playlists |> List.reverse fetchPlaylists : Task x ( List Playlist, Time.Zone ) @@ -127,6 +127,7 @@ fetchPlaylistWithVideos name = fetchPlaylistVideoPaths name |> Task.andThen (\c -> fetchVideos name c) |> Task.map (PlaylistWithVideos name a) + |> Task.map sortPlaylistWithVideos )