@@ -6,6 +6,8 @@ import Html.Events as Events
66import HtmlHelpers exposing (hideOnBreakpoint )
77import Http
88import Json.Decode
9+ import Random
10+ import Random.List exposing (shuffle )
911import Set
1012import Task
1113import Time
@@ -71,7 +73,7 @@ type Msg
7173 = Right
7274 | Left
7375 | GotTestimonials ( Result Http . Error ( List Testimonial ))
74- | SetRandomizedIndex Time . Posix
76+ | GotShuffledTetsemonials ( List Testimonial )
7577
7678
7779update : Msg -> Model -> ( Model , Cmd Msg )
@@ -83,11 +85,11 @@ update msg model =
8385 ( Success testimonials index, Left ) ->
8486 ( Success testimonials ( changeOrRollover testimonials ( index - 1 )) , Cmd . none )
8587
86- ( Success testimonials _ , SetRandomizedIndex time ) ->
87- ( Success testimonials ( changeOrRollover testimonials ( time |> Time . posixToMillis )) , Cmd . none )
88+ ( Loading , GotShuffledTetsemonials testimonials ) ->
89+ ( Success testimonials 0 , Cmd . none )
8890
8991 ( _, GotTestimonials ( Ok testimonials) ) ->
90- ( Success testimonials 0 , Cmd . none )
92+ ( Loading , Random . generate GotShuffledTetsemonials ( shuffle testimonials ) )
9193
9294 ( _, GotTestimonials ( Err _) ) ->
9395 ( Failure , Cmd . none )
0 commit comments