Skip to content
This repository has been archived by the owner on Dec 10, 2023. It is now read-only.

Commit

Permalink
Remove usage of |> when it doesn't represent some kind of transformat…
Browse files Browse the repository at this point in the history
…ive pipeline
  • Loading branch information
paulfioravanti committed Nov 22, 2023
1 parent f7b979a commit 0b6cb29
Show file tree
Hide file tree
Showing 32 changed files with 332 additions and 364 deletions.
3 changes: 1 addition & 2 deletions front_end/src/ApiUrl.elm
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ determineUrlFromEnvironment : Value -> String
determineUrlFromEnvironment environmentFlag =
let
environment =
environmentFlag
|> Decode.decodeValue Decode.string
Decode.decodeValue Decode.string environmentFlag
in
case environment of
Ok "development" ->
Expand Down
8 changes: 3 additions & 5 deletions front_end/src/Data.elm
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ import RemoteData exposing (WebData)
fetch : String -> Decoder a -> (WebData a -> msg) -> Cmd msg
fetch apiUrl decoder callbackMsg =
let
remoteData =
callbackMsg << RemoteData.fromResult

response =
decoder
|> Http.expectJson remoteData
Http.expectJson
(\result -> callbackMsg (RemoteData.fromResult result))
decoder
in
Http.get { url = apiUrl, expect = response }
14 changes: 7 additions & 7 deletions front_end/src/Header/Styles.elm
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ module Header.Styles exposing (layout)

layout : String
layout =
[ "center"
, "flex"
, "flex-row-reverse"
, "mt1"
, "mw8"
]
|> String.join " "
String.join " "
[ "center"
, "flex"
, "flex-row-reverse"
, "mt1"
, "mw8"
]
6 changes: 3 additions & 3 deletions front_end/src/LanguageSelector/Model.elm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ English.
-}
selectableLanguages : Language -> List Language
selectableLanguages currentLanguage =
Language.availableLanguages
|> List.filter
(\availableLanguage -> availableLanguage /= currentLanguage)
List.filter
(\availableLanguage -> availableLanguage /= currentLanguage)
Language.availableLanguages
78 changes: 39 additions & 39 deletions front_end/src/LanguageSelector/Styles.elm
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ import Styles

countryFlag : String -> String
countryFlag flagClass =
[ flagClass
, "flex-auto"
]
|> String.join " "
String.join " "
[ flagClass
, "flex-auto"
]


currentSelection : Bool -> String
Expand All @@ -50,25 +50,25 @@ currentSelection showSelectableLanguages =
else
"b--white"
in
[ borderClass
, "ba"
, "bg-white"
, "flex"
, "items-center"
, "mv0"
, "pa2"
, "tc"
]
|> String.join " "
String.join " "
[ borderClass
, "ba"
, "bg-white"
, "flex"
, "items-center"
, "mv0"
, "pa2"
, "tc"
]


dropdownMenu : String
dropdownMenu =
[ "relative"
, "pointer"
, "w3"
]
|> String.join " "
String.join " "
[ "relative"
, "pointer"
, "w3"
]


dropdownMenuCss : Style
Expand Down Expand Up @@ -115,22 +115,22 @@ dropdownMenuList showSelectableLanguages =
else
""
in
[ displayClass
, "absolute"
, "b--black-10"
, "bb"
, "bg-white"
, "bl"
, "br"
, "items-center"
, "list"
, "ma0"
, "pa0"
, "tc"
, "top-2"
, "w3"
]
|> String.join " "
String.join " "
[ displayClass
, "absolute"
, "b--black-10"
, "bb"
, "bg-white"
, "bl"
, "br"
, "items-center"
, "list"
, "ma0"
, "pa0"
, "tc"
, "top-2"
, "w3"
]


dropdownMenuListCss : Bool -> Style
Expand All @@ -154,10 +154,10 @@ dropdownMenuListCss showSelectableLanguages =

dropdownMenuListItem : String
dropdownMenuListItem =
[ "pa2"
, "w-100"
]
|> String.join " "
String.join " "
[ "pa2"
, "w-100"
]


dropdownMenuListItemCss : Style
Expand Down
5 changes: 3 additions & 2 deletions front_end/src/Model.elm
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ changeLanguage : Language -> Model -> Model
changeLanguage language model =
let
languageSelector =
model.languageSelector
|> LanguageSelector.updateSelectableLanguages language
LanguageSelector.updateSelectableLanguages
language
model.languageSelector
in
{ model
| language = language
Expand Down
3 changes: 1 addition & 2 deletions front_end/src/Page/Error.elm
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ message : Language -> Error -> Html msg
message language error =
let
( name, messageContent ) =
error
|> errorToMessage language
errorToMessage language error
in
div
[ attribute "data-name" name
Expand Down
36 changes: 18 additions & 18 deletions front_end/src/Page/Error/Styles.elm
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@ brandColorAlpha =

content : String
content =
[ "avenir"
, "light-silver"
, "mv2"
]
|> String.join " "
String.join " "
[ "avenir"
, "light-silver"
, "mv2"
]


heading : String
heading =
[ "f2 f1-ns"
, "ttu"
]
|> String.join " "
String.join " "
[ "f2 f1-ns"
, "ttu"
]


icon : String
icon =
-- NOTE: fa-prefixed classes are from Font Awesome.
[ "fa-4x"
, "fa-frown"
, "far"
]
|> String.join " "
String.join " "
[ "fa-4x"
, "fa-frown"
, "far"
]


layout : String
Expand All @@ -54,7 +54,7 @@ layout =

message : String
message =
[ "f6"
, "tc"
]
|> String.join " "
String.join " "
[ "f6"
, "tc"
]
12 changes: 6 additions & 6 deletions front_end/src/Page/Loading/Styles.elm
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ heading =
icon : String
icon =
-- NOTE: fa-prefixed classes are from Font Awesome.
[ "fa-4x"
, "fa-pulse"
, "fa-spinner"
, "fas"
]
|> String.join " "
String.join " "
[ "fa-4x"
, "fa-pulse"
, "fa-spinner"
, "fas"
]


layout : String
Expand Down
24 changes: 12 additions & 12 deletions front_end/src/Page/NotFound/Styles.elm
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import Styles

backToHomeLink : String
backToHomeLink =
[ "avenir"
, "f5"
, "hover-gray"
, "light-silver"
, "link"
]
|> String.join " "
String.join " "
[ "avenir"
, "f5"
, "hover-gray"
, "light-silver"
, "link"
]


brandColorAlpha : Style
Expand All @@ -38,11 +38,11 @@ heading =
icon : String
icon =
-- NOTE: fa-prefixed classes are from Font Awesome.
[ "fa-4x"
, "fa-meh"
, "far"
]
|> String.join " "
String.join " "
[ "fa-4x"
, "fa-meh"
, "far"
]


layout : String
Expand Down
30 changes: 15 additions & 15 deletions front_end/src/Page/Styles.elm
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ module Page.Styles exposing (heading, layout)

heading : String
heading =
[ "avenir"
, "f2 f1-ns"
, "light-silver"
, "mv2"
, "ttu"
]
|> String.join " "
String.join " "
[ "avenir"
, "f2 f1-ns"
, "light-silver"
, "mv2"
, "ttu"
]


layout : String
layout =
[ "flex"
, "flex-column"
, "items-center"
, "justify-center"
, "tc"
, "vh-75"
]
|> String.join " "
String.join " "
[ "flex"
, "flex-column"
, "items-center"
, "justify-center"
, "tc"
, "vh-75"
]
17 changes: 5 additions & 12 deletions front_end/src/Question/Aggregation.elm
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ averageScore question =
|> countValidResponses
|> toFloat
in
sumScores
/ numScores
|> Round.round 2
Round.round 2 (sumScores / numScores)


{-| Sums the `responseContent` rating values from a `Question`.
Expand Down Expand Up @@ -108,14 +106,10 @@ Only valid `responseContent` values between values 1-5 are included in the sum.
sumValidResponses : Question -> Int
sumValidResponses { surveyResponses } =
let
addResponseContent =
\surveyResponse acc ->
surveyResponse
|> SurveyResponse.ratingScore
|> (+) acc
addResponseContent surveyResponse acc =
acc + SurveyResponse.ratingScore surveyResponse
in
surveyResponses
|> List.foldl addResponseContent 0
List.foldl addResponseContent 0 surveyResponses



Expand All @@ -124,5 +118,4 @@ sumValidResponses { surveyResponses } =

countValidResponses : Question -> Int
countValidResponses { surveyResponses } =
surveyResponses
|> List.foldl SurveyResponse.countValidResponse 0
List.foldl SurveyResponse.countValidResponse 0 surveyResponses
Loading

0 comments on commit 0b6cb29

Please sign in to comment.