From 1407641e45fd29976673bb0dfba44ce0d74e16f2 Mon Sep 17 00:00:00 2001 From: Pier-Luc Faucher Date: Wed, 4 Nov 2020 06:33:02 -0500 Subject: [PATCH] Latest stable is now the default channel (#221) fixes #220 --- src/Search.elm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Search.elm b/src/Search.elm index b8eeebd..03a4ea8 100644 --- a/src/Search.elm +++ b/src/Search.elm @@ -118,30 +118,30 @@ type Sort init : Route.SearchArgs -> Maybe (Model a) -> ( Model a, Cmd (Msg a) ) init args model = let - defaultChannel = + channel = model |> Maybe.map (\x -> x.channel) - |> Maybe.withDefault "unstable" + |> Maybe.withDefault defaultChannel - defaultFrom = + from = model |> Maybe.map (\x -> x.from) |> Maybe.withDefault 0 - defaultSize = + size = model |> Maybe.map (\x -> x.size) |> Maybe.withDefault 30 in - ( { channel = Maybe.withDefault defaultChannel args.channel + ( { channel = Maybe.withDefault channel args.channel , query = Maybe.andThen Route.SearchQuery.searchQueryToString args.query , result = model |> Maybe.map (\x -> x.result) |> Maybe.withDefault RemoteData.NotAsked , show = args.show - , from = Maybe.withDefault defaultFrom args.from - , size = Maybe.withDefault defaultSize args.size + , from = Maybe.withDefault from args.from + , size = Maybe.withDefault size args.size , sort = args.sort |> Maybe.withDefault "" @@ -272,6 +272,11 @@ type alias ChannelDetails = } +defaultChannel : String +defaultChannel = + "20.09" + + channelDetails : Channel -> ChannelDetails channelDetails channel = case channel of