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