Parse app status score as int
continuous-integration/drone/push Build is failing Details

This commit is contained in:
3wc 2021-04-25 15:37:32 +02:00
parent 1df298fa25
commit 33ddb9e390
1 changed files with 12 additions and 18 deletions

View File

@ -33,7 +33,7 @@ type alias App =
, repository : Maybe String , repository : Maybe String
, versions : Maybe (List String) , versions : Maybe (List String)
, icon : Maybe String , icon : Maybe String
, status : String , status : Int
, slug : String , slug : String
, website : Maybe String , website : Maybe String
} }
@ -102,13 +102,13 @@ body model =
appScore : App -> Int appScore : App -> Int
appScore app = appScore app =
case app.status of case app.status of
"1" -> 1 ->
1 1
"2" -> 2 ->
2 2
"3" -> 3 ->
3 3
"4" -> 4 ->
4 4
_ -> _ ->
5 5
@ -118,25 +118,19 @@ viewStatusBadge app =
let let
status_class = status_class =
case app.status of case app.status of
"1" -> 1 ->
"badge-success" "badge-success"
"2" -> 2 ->
"badge-info" "badge-info"
"3" -> 3 ->
"badge-warning" "badge-warning"
"4" -> 4 ->
"badge-danger" "badge-danger"
_ -> _ ->
"badge-dark" "badge-dark"
status_score =
case app.status of
"" ->
"?"
score ->
score
in in
span [ class ("card-link badge " ++ status_class) ] span [ class ("card-link badge " ++ status_class) ]
[ text ("Score: " ++ status_score) ] [ text ("Score: " ++ String.fromInt app.status) ]
viewApp : App -> Html Msg viewApp : App -> Html Msg
viewApp app = viewApp app =
@ -228,8 +222,8 @@ loadApps =
featuresDecoder = featuresDecoder =
(Decode.oneOf (Decode.oneOf
[ Decode.at [ "status" ] Decode.string [ Decode.at [ "status" ] Decode.int
, Decode.succeed "" , Decode.succeed 5
] ]
) )