From 0b6cb296827133fd8e898232c38754a4900223d8 Mon Sep 17 00:00:00 2001 From: Paul Fioravanti Date: Wed, 22 Nov 2023 11:42:57 +1100 Subject: [PATCH] Remove usage of |> when it doesn't represent some kind of transformative pipeline --- front_end/src/ApiUrl.elm | 3 +- front_end/src/Data.elm | 8 +- front_end/src/Header/Styles.elm | 14 +-- front_end/src/LanguageSelector/Model.elm | 6 +- front_end/src/LanguageSelector/Styles.elm | 78 +++++++-------- front_end/src/Model.elm | 5 +- front_end/src/Page/Error.elm | 3 +- front_end/src/Page/Error/Styles.elm | 36 +++---- front_end/src/Page/Loading/Styles.elm | 12 +-- front_end/src/Page/NotFound/Styles.elm | 24 ++--- front_end/src/Page/Styles.elm | 30 +++--- front_end/src/Question/Aggregation.elm | 17 +--- front_end/src/Question/Styles.elm | 64 ++++++------- front_end/src/Question/View.elm | 3 +- front_end/src/Route.elm | 3 +- front_end/src/Styles.elm | 10 +- .../SurveyResponse/RespondentHistogram.elm | 11 +-- front_end/src/SurveyResponse/Styles.elm | 38 ++++---- .../src/SurveyResponse/Tooltip/Styles.elm | 26 ++--- front_end/src/SurveyResponse/Tooltip/View.elm | 9 +- front_end/src/SurveyResult/Detail/Decoder.elm | 3 +- .../SurveyResult/Detail/Overview/Styles.elm | 38 ++++---- front_end/src/SurveyResult/Detail/Styles.elm | 96 +++++++++---------- front_end/src/SurveyResult/Detail/View.elm | 3 +- front_end/src/SurveyResultList/Data.elm | 6 +- front_end/src/SurveyResultList/Path.elm | 3 +- front_end/src/SurveyResultList/Styles.elm | 30 +++--- front_end/src/SurveyResultList/Update.elm | 9 +- front_end/src/SurveyResultList/View.elm | 3 +- front_end/src/Theme/Aggregation.elm | 25 +++-- front_end/src/Theme/Styles.elm | 48 +++++----- front_end/src/Update.elm | 32 +++---- 32 files changed, 332 insertions(+), 364 deletions(-) diff --git a/front_end/src/ApiUrl.elm b/front_end/src/ApiUrl.elm index 50baeb8..fac6b63 100644 --- a/front_end/src/ApiUrl.elm +++ b/front_end/src/ApiUrl.elm @@ -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" -> diff --git a/front_end/src/Data.elm b/front_end/src/Data.elm index 4f15a10..2757e7c 100644 --- a/front_end/src/Data.elm +++ b/front_end/src/Data.elm @@ -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 } diff --git a/front_end/src/Header/Styles.elm b/front_end/src/Header/Styles.elm index 64d7df7..07ad629 100644 --- a/front_end/src/Header/Styles.elm +++ b/front_end/src/Header/Styles.elm @@ -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" + ] diff --git a/front_end/src/LanguageSelector/Model.elm b/front_end/src/LanguageSelector/Model.elm index dfc7f0a..5ff3f0f 100644 --- a/front_end/src/LanguageSelector/Model.elm +++ b/front_end/src/LanguageSelector/Model.elm @@ -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 diff --git a/front_end/src/LanguageSelector/Styles.elm b/front_end/src/LanguageSelector/Styles.elm index af2fdab..fc392fd 100644 --- a/front_end/src/LanguageSelector/Styles.elm +++ b/front_end/src/LanguageSelector/Styles.elm @@ -34,10 +34,10 @@ import Styles countryFlag : String -> String countryFlag flagClass = - [ flagClass - , "flex-auto" - ] - |> String.join " " + String.join " " + [ flagClass + , "flex-auto" + ] currentSelection : Bool -> String @@ -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 @@ -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 @@ -154,10 +154,10 @@ dropdownMenuListCss showSelectableLanguages = dropdownMenuListItem : String dropdownMenuListItem = - [ "pa2" - , "w-100" - ] - |> String.join " " + String.join " " + [ "pa2" + , "w-100" + ] dropdownMenuListItemCss : Style diff --git a/front_end/src/Model.elm b/front_end/src/Model.elm index 2859c0c..c0ad15d 100644 --- a/front_end/src/Model.elm +++ b/front_end/src/Model.elm @@ -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 diff --git a/front_end/src/Page/Error.elm b/front_end/src/Page/Error.elm index 42faf9e..7822bb9 100644 --- a/front_end/src/Page/Error.elm +++ b/front_end/src/Page/Error.elm @@ -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 diff --git a/front_end/src/Page/Error/Styles.elm b/front_end/src/Page/Error/Styles.elm index 665e6e1..ce1e225 100644 --- a/front_end/src/Page/Error/Styles.elm +++ b/front_end/src/Page/Error/Styles.elm @@ -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 @@ -54,7 +54,7 @@ layout = message : String message = - [ "f6" - , "tc" - ] - |> String.join " " + String.join " " + [ "f6" + , "tc" + ] diff --git a/front_end/src/Page/Loading/Styles.elm b/front_end/src/Page/Loading/Styles.elm index 03a7579..5e2294f 100644 --- a/front_end/src/Page/Loading/Styles.elm +++ b/front_end/src/Page/Loading/Styles.elm @@ -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 diff --git a/front_end/src/Page/NotFound/Styles.elm b/front_end/src/Page/NotFound/Styles.elm index 8c17852..9a0eebd 100644 --- a/front_end/src/Page/NotFound/Styles.elm +++ b/front_end/src/Page/NotFound/Styles.elm @@ -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 @@ -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 diff --git a/front_end/src/Page/Styles.elm b/front_end/src/Page/Styles.elm index 40b019d..219d558 100644 --- a/front_end/src/Page/Styles.elm +++ b/front_end/src/Page/Styles.elm @@ -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" + ] diff --git a/front_end/src/Question/Aggregation.elm b/front_end/src/Question/Aggregation.elm index 1b69ea9..5f06314 100644 --- a/front_end/src/Question/Aggregation.elm +++ b/front_end/src/Question/Aggregation.elm @@ -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`. @@ -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 @@ -124,5 +118,4 @@ sumValidResponses { surveyResponses } = countValidResponses : Question -> Int countValidResponses { surveyResponses } = - surveyResponses - |> List.foldl SurveyResponse.countValidResponse 0 + List.foldl SurveyResponse.countValidResponse 0 surveyResponses diff --git a/front_end/src/Question/Styles.elm b/front_end/src/Question/Styles.elm index 475c581..7d9d46b 100644 --- a/front_end/src/Question/Styles.elm +++ b/front_end/src/Question/Styles.elm @@ -16,29 +16,29 @@ import Css exposing (Style, overline, textDecoration) averageScore : String averageScore = - [ "fw5" - , "mt2 mt3-ns" - , "tr" - ] - |> String.join " " + String.join " " + [ "fw5" + , "mt2 mt3-ns" + , "tr" + ] averageScoreLabel : String averageScoreLabel = - [ "fw1" - , "i" - , "mr2" - , "times" - ] - |> String.join " " + String.join " " + [ "fw1" + , "i" + , "mr2" + , "times" + ] descriptionText : String descriptionText = - [ "fw4" - , "w-70-ns" - ] - |> String.join " " + String.join " " + [ "fw4" + , "w-70-ns" + ] overlineText : Style @@ -48,28 +48,28 @@ overlineText = question : String question = - [ "flex" - , "flex-column flex-row-ns" - , "justify-between-ns" - , "mh1 mh0-ns" - , "mv2" - ] - |> String.join " " + String.join " " + [ "flex" + , "flex-column flex-row-ns" + , "justify-between-ns" + , "mh1 mh0-ns" + , "mv2" + ] responses : String responses = - [ "flex" - , "flex-row" - , "mr3 mr0-ns" - ] - |> String.join " " + String.join " " + [ "flex" + , "flex-row" + , "mr3 mr0-ns" + ] scores : String scores = - [ "flex" - , "flex-row-reverse flex-column-ns" - , "justify-between-ns" - ] - |> String.join " " + String.join " " + [ "flex" + , "flex-row-reverse flex-column-ns" + , "justify-between-ns" + ] diff --git a/front_end/src/Question/View.elm b/front_end/src/Question/View.elm index 646497b..f80bda3 100644 --- a/front_end/src/Question/View.elm +++ b/front_end/src/Question/View.elm @@ -56,8 +56,7 @@ responses : Language -> Question -> Html msg responses language question = let respondents = - question.surveyResponses - |> SurveyResponse.respondentHistogram + SurveyResponse.respondentHistogram question.surveyResponses in div [ attribute "data-name" "survey-responses" diff --git a/front_end/src/Route.elm b/front_end/src/Route.elm index abae989..59f72fe 100644 --- a/front_end/src/Route.elm +++ b/front_end/src/Route.elm @@ -48,8 +48,7 @@ type Route -} init : Url -> Maybe Route init url = - url - |> Parser.parse matchers + Parser.parse matchers url {-| Translates a Route into a path string diff --git a/front_end/src/Styles.elm b/front_end/src/Styles.elm index 19a423c..96cea51 100644 --- a/front_end/src/Styles.elm +++ b/front_end/src/Styles.elm @@ -24,11 +24,11 @@ import Css body : String body = - [ "bg-white" - , "sans-serif" - , "w-100" - ] - |> String.join " " + String.join " " + [ "bg-white" + , "sans-serif" + , "w-100" + ] brandBackgroundColor : Style diff --git a/front_end/src/SurveyResponse/RespondentHistogram.elm b/front_end/src/SurveyResponse/RespondentHistogram.elm index 349dfbd..b5cc218 100644 --- a/front_end/src/SurveyResponse/RespondentHistogram.elm +++ b/front_end/src/SurveyResponse/RespondentHistogram.elm @@ -62,16 +62,15 @@ init surveyResponses = let prependRatingToList { respondentId, responseContent } histogram = if Dict.member responseContent histogram then - histogram - |> Dict.update - responseContent - (Maybe.map ((::) (String.fromInt respondentId))) + Dict.update + responseContent + (Maybe.map ((::) (String.fromInt respondentId))) + histogram else histogram in - surveyResponses - |> List.foldl prependRatingToList initialHistogram + List.foldl prependRatingToList initialHistogram surveyResponses diff --git a/front_end/src/SurveyResponse/Styles.elm b/front_end/src/SurveyResponse/Styles.elm index 6467859..129c669 100644 --- a/front_end/src/SurveyResponse/Styles.elm +++ b/front_end/src/SurveyResponse/Styles.elm @@ -15,20 +15,20 @@ import Styles surveyResponseContent : String surveyResponseContent = - [ "b--light-silver" - , "ba" - , "bg-moon-gray" - , "br4" - , "dtc" - , "h2" - , "hover-white" - , "pointer" - , "relative" - , "tc" - , "v-mid" - , "w2" - ] - |> String.join " " + String.join " " + [ "b--light-silver" + , "ba" + , "bg-moon-gray" + , "br4" + , "dtc" + , "h2" + , "hover-white" + , "pointer" + , "relative" + , "tc" + , "v-mid" + , "w2" + ] surveyResponseContentCss : Style @@ -45,11 +45,11 @@ surveyResponseContentCss = surveyResponse : String surveyResponse = - [ "dt" - , "mh1" - , "no-underline" - ] - |> String.join " " + String.join " " + [ "dt" + , "mh1" + , "no-underline" + ] surveyResponseCss : Style diff --git a/front_end/src/SurveyResponse/Tooltip/Styles.elm b/front_end/src/SurveyResponse/Tooltip/Styles.elm index 14bf7c7..be8e1b8 100644 --- a/front_end/src/SurveyResponse/Tooltip/Styles.elm +++ b/front_end/src/SurveyResponse/Tooltip/Styles.elm @@ -28,19 +28,19 @@ import Css tooltip : String tooltip = - [ "absolute" - , "avenir" - , "bg-dark-gray" - , "br3" - , "f6" - , "nl5" - , "pa1" - , "tc" - , "w4" - , "white" - , "z-1" - ] - |> String.join " " + String.join " " + [ "absolute" + , "avenir" + , "bg-dark-gray" + , "br3" + , "f6" + , "nl5" + , "pa1" + , "tc" + , "w4" + , "white" + , "z-1" + ] tooltipCss : Style diff --git a/front_end/src/SurveyResponse/Tooltip/View.elm b/front_end/src/SurveyResponse/Tooltip/View.elm index bf29258..bd5cdb8 100644 --- a/front_end/src/SurveyResponse/Tooltip/View.elm +++ b/front_end/src/SurveyResponse/Tooltip/View.elm @@ -13,8 +13,7 @@ view : Language -> String -> RespondentHistogram -> Html msg view language rating histogram = let ( attributeName, respondents ) = - histogram - |> respondentsByResponseContent language rating + respondentsByResponseContent language rating histogram in span [ attribute "data-name" attributeName @@ -89,8 +88,7 @@ displayAllRespondents language respondents = ) headIds = - head - |> String.join ", " + String.join ", " head tailId = tail @@ -108,8 +106,7 @@ truncatedRespondents : truncatedRespondents language respondentsToDisplay truncatedRespondentsList = let idsToDisplay = - respondentsToDisplay - |> String.join ", " + String.join ", " respondentsToDisplay numTruncated = List.length truncatedRespondentsList diff --git a/front_end/src/SurveyResult/Detail/Decoder.elm b/front_end/src/SurveyResult/Detail/Decoder.elm index 6f84eb9..7ba4a72 100644 --- a/front_end/src/SurveyResult/Detail/Decoder.elm +++ b/front_end/src/SurveyResult/Detail/Decoder.elm @@ -79,5 +79,4 @@ decoder = surveyResult = Decoder.decoder in - surveyResult - |> Decode.at [ "survey_result_detail" ] + Decode.at [ "survey_result_detail" ] surveyResult diff --git a/front_end/src/SurveyResult/Detail/Overview/Styles.elm b/front_end/src/SurveyResult/Detail/Overview/Styles.elm index 4ae0a0a..624599a 100644 --- a/front_end/src/SurveyResult/Detail/Overview/Styles.elm +++ b/front_end/src/SurveyResult/Detail/Overview/Styles.elm @@ -6,30 +6,30 @@ module SurveyResult.Detail.Overview.Styles exposing (label, summary, value) label : String label = - [ "f4 f3-ns" - , "fw2" - ] - |> String.join " " + String.join " " + [ "f4 f3-ns" + , "fw2" + ] summary : String summary = - [ "bg-light-gray" - , "br3-ns" - , "flex" - , "flex-row" - , "justify-between" - , "mv2" - , "pa2" - , "tc" - ] - |> String.join " " + String.join " " + [ "bg-light-gray" + , "br3-ns" + , "flex" + , "flex-row" + , "justify-between" + , "mv2" + , "pa2" + , "tc" + ] value : String value = - [ "f4 f3-ns" - , "fw8" - , "tc" - ] - |> String.join " " + String.join " " + [ "f4 f3-ns" + , "fw8" + , "tc" + ] diff --git a/front_end/src/SurveyResult/Detail/Styles.elm b/front_end/src/SurveyResult/Detail/Styles.elm index 1a5d078..d43e496 100644 --- a/front_end/src/SurveyResult/Detail/Styles.elm +++ b/front_end/src/SurveyResult/Detail/Styles.elm @@ -19,12 +19,12 @@ import Styles article : String article = - [ "center" - , "flex" - , "flex-column" - , "mw7-ns" - ] - |> String.join " " + String.join " " + [ "center" + , "flex" + , "flex-column" + , "mw7-ns" + ] brandColor : Style @@ -34,18 +34,18 @@ brandColor = footerContent : String footerContent = - [ "b--dotted" - , "b--light-gray" - , "bb-0" - , "bl-0" - , "br-0" - , "bt" - , "center" - , "mt4" - , "mw7" - , "tc" - ] - |> String.join " " + String.join " " + [ "b--dotted" + , "b--light-gray" + , "bb-0" + , "bl-0" + , "br-0" + , "bt" + , "center" + , "mt4" + , "mw7" + , "tc" + ] footerLink : String @@ -55,50 +55,50 @@ footerLink = footerLogo : String footerLogo = - [ "h3 h4-ns" - , "img" - , "mh0 mh2-ns" - , "mt0 mv3-ns" - ] - |> String.join " " + String.join " " + [ "h3 h4-ns" + , "img" + , "mh0 mh2-ns" + , "mt0 mv3-ns" + ] surveyName : String surveyName = - [ "center" - , "flex" - , "flex-row" - ] - |> String.join " " + String.join " " + [ "center" + , "flex" + , "flex-row" + ] surveyNameHeading : String surveyNameHeading = - [ "avenir" - , "f2 f1-ns" - , "mid-gray" - , "mw5 mw7-ns" - , "tc" - ] - |> String.join " " + String.join " " + [ "avenir" + , "f2 f1-ns" + , "mid-gray" + , "mw5 mw7-ns" + , "tc" + ] surveyResultsLink : String surveyResultsLink = - [ "absolute" - , "dim" - , "ml2 ml0-ns" - , "mt3 mt4-ns" - , "pt2 pt1-ns" - ] - |> String.join " " + String.join " " + [ "absolute" + , "dim" + , "ml2 ml0-ns" + , "mt3 mt4-ns" + , "pt2 pt1-ns" + ] surveyResultsLinkIcon : String surveyResultsLinkIcon = -- NOTE: fa-prefixed classes are from Font Awesome. - [ "f2 f1-ns" - , "fa-angle-left" - , "fas" - ] - |> String.join " " + String.join " " + [ "f2 f1-ns" + , "fa-angle-left" + , "fas" + ] diff --git a/front_end/src/SurveyResult/Detail/View.elm b/front_end/src/SurveyResult/Detail/View.elm index fe5dc80..7af6888 100644 --- a/front_end/src/SurveyResult/Detail/View.elm +++ b/front_end/src/SurveyResult/Detail/View.elm @@ -68,8 +68,7 @@ surveyResultThemes : Language -> Maybe (List Theme) -> Html msg surveyResultThemes language maybeThemes = let themes = - maybeThemes - |> Maybe.withDefault [] + Maybe.withDefault [] maybeThemes in div [ attribute "data-name" "themes" ] (List.map (Theme.view language) themes) diff --git a/front_end/src/SurveyResultList/Data.elm b/front_end/src/SurveyResultList/Data.elm index 25a6c3b..88cbdbe 100644 --- a/front_end/src/SurveyResultList/Data.elm +++ b/front_end/src/SurveyResultList/Data.elm @@ -80,9 +80,7 @@ view language webData = Loading.view language RemoteData.Success data -> - data - |> View.view language + View.view language data RemoteData.Failure error -> - error - |> Error.view language + Error.view language error diff --git a/front_end/src/SurveyResultList/Path.elm b/front_end/src/SurveyResultList/Path.elm index 1cd702a..34ba369 100644 --- a/front_end/src/SurveyResultList/Path.elm +++ b/front_end/src/SurveyResultList/Path.elm @@ -5,5 +5,4 @@ import Route path : String path = - Route.SurveyResultList - |> Route.toString + Route.toString Route.SurveyResultList diff --git a/front_end/src/SurveyResultList/Styles.elm b/front_end/src/SurveyResultList/Styles.elm index bb46e46..b887418 100644 --- a/front_end/src/SurveyResultList/Styles.elm +++ b/front_end/src/SurveyResultList/Styles.elm @@ -14,12 +14,12 @@ import Css.Media exposing (minWidth, only, screen, withMedia) heading : String heading = - [ "avenir" - , "dark-gray" - , "mv3" - , "ttu" - ] - |> String.join " " + String.join " " + [ "avenir" + , "dark-gray" + , "mv3" + , "ttu" + ] headingCss : Style @@ -34,16 +34,16 @@ headingCss = section : String section = - [ "center" - , "mw7" - ] - |> String.join " " + String.join " " + [ "center" + , "mw7" + ] surveyResultList : String surveyResultList = - [ "flex" - , "justify-around" - , "mt1" - ] - |> String.join " " + String.join " " + [ "flex" + , "justify-around" + , "mt1" + ] diff --git a/front_end/src/SurveyResultList/Update.elm b/front_end/src/SurveyResultList/Update.elm index 3adcec4..fdfa37a 100644 --- a/front_end/src/SurveyResultList/Update.elm +++ b/front_end/src/SurveyResultList/Update.elm @@ -13,19 +13,16 @@ update language msg = Msg.Load apiUrl webData -> let ( surveyResultList, cmd ) = - webData - |> Data.load apiUrl + Data.load apiUrl webData title = - surveyResultList - |> Data.title language + Data.title language surveyResultList in ( surveyResultList, title, cmd ) Msg.Fetched surveyResultList -> let title = - surveyResultList - |> Data.title language + Data.title language surveyResultList in ( surveyResultList, title, Cmd.none ) diff --git a/front_end/src/SurveyResultList/View.elm b/front_end/src/SurveyResultList/View.elm index 7e9ffb3..d3fed97 100644 --- a/front_end/src/SurveyResultList/View.elm +++ b/front_end/src/SurveyResultList/View.elm @@ -28,8 +28,7 @@ surveyResultList : Language -> List SurveyResult -> List (Html msg) surveyResultList language surveyResults = let surveyResults_ = - surveyResults - |> List.map (SurveyResult.summaryView language) + List.map (SurveyResult.summaryView language) surveyResults in div [ class Styles.surveyResultList ] [ heading language ] diff --git a/front_end/src/Theme/Aggregation.elm b/front_end/src/Theme/Aggregation.elm index b44ab2d..44f73da 100644 --- a/front_end/src/Theme/Aggregation.elm +++ b/front_end/src/Theme/Aggregation.elm @@ -84,9 +84,7 @@ averageScore theme = |> countValidResponses |> toFloat in - sumScores - / numScores - |> Round.round 2 + Round.round 2 (sumScores / numScores) @@ -97,21 +95,22 @@ countValidResponses : Theme -> Int countValidResponses { questions } = let addQuestionSurveyResponsesCount question acc = - question.surveyResponses - |> List.foldl SurveyResponse.countValidResponse 0 - |> (+) acc + let + count = + List.foldl + SurveyResponse.countValidResponse + 0 + question.surveyResponses + in + acc + count in - questions - |> List.foldl addQuestionSurveyResponsesCount 0 + List.foldl addQuestionSurveyResponsesCount 0 questions sumValidResponses : Theme -> Int sumValidResponses { questions } = let addQuestionSum question acc = - question - |> Question.sumValidResponses - |> (+) acc + acc + Question.sumValidResponses question in - questions - |> List.foldl addQuestionSum 0 + List.foldl addQuestionSum 0 questions diff --git a/front_end/src/Theme/Styles.elm b/front_end/src/Theme/Styles.elm index 49334d4..7bcafd0 100644 --- a/front_end/src/Theme/Styles.elm +++ b/front_end/src/Theme/Styles.elm @@ -12,19 +12,19 @@ module Theme.Styles exposing averageScore : String averageScore = - [ "b" - , "f4 f3-ns" - , "mid-gray" - ] - |> String.join " " + String.join " " + [ "b" + , "f4 f3-ns" + , "mid-gray" + ] averageScoreLabel : String averageScoreLabel = - [ "fw2" - , "mr2" - ] - |> String.join " " + String.join " " + [ "fw2" + , "mr2" + ] averageScoreValue : String @@ -34,22 +34,22 @@ averageScoreValue = theme : String theme = - [ "b--light-gray" - , "bb" - , "flex" - , "flex-row" - , "justify-between" - , "mb3" - , "mh1 mh0-ns" - , "mt4" - ] - |> String.join " " + String.join " " + [ "b--light-gray" + , "bb" + , "flex" + , "flex-row" + , "justify-between" + , "mb3" + , "mh1 mh0-ns" + , "mt4" + ] name : String name = - [ "f4 f3-ns" - , "mid-gray" - , "ttu" - ] - |> String.join " " + String.join " " + [ "f4 f3-ns" + , "mid-gray" + , "ttu" + ] diff --git a/front_end/src/Update.elm b/front_end/src/Update.elm index 1b4147b..8382d2c 100644 --- a/front_end/src/Update.elm +++ b/front_end/src/Update.elm @@ -19,13 +19,10 @@ update msg model = Msg.ChangeLanguage language -> let maybeChangeRoute = - model.navigation.route - |> Cmd.maybeChangeRoute + Cmd.maybeChangeRoute model.navigation.route storeLanguage = - language - |> Language.toString - |> Ports.storeLanguage + Ports.storeLanguage (Language.toString language) hideSelectableLanguages = Cmd.hideSelectableLanguages @@ -41,24 +38,23 @@ update msg model = Msg.ChangeRoute route -> let loadDataForRoute = - model - |> Cmd.loadDataForRoute route + Cmd.loadDataForRoute route model in ( model, loadDataForRoute ) Msg.LanguageSelector msgForLanguageSelector -> let languageSelector = - model.languageSelector - |> LanguageSelector.update msgForLanguageSelector + LanguageSelector.update + msgForLanguageSelector + model.languageSelector in ( { model | languageSelector = languageSelector }, Cmd.none ) Msg.SurveyResult msgForSurveyResult -> let ( surveyResult, title, cmd ) = - msgForSurveyResult - |> SurveyResult.update model.language + SurveyResult.update model.language msgForSurveyResult in ( { model | surveyResultDetail = surveyResult, title = title } , Cmd.map Msg.SurveyResult cmd @@ -67,8 +63,9 @@ update msg model = Msg.SurveyResultList msgForSurveyResultList -> let ( surveyResultList, title, cmd ) = - msgForSurveyResultList - |> SurveyResultList.update model.language + SurveyResultList.update + model.language + msgForSurveyResultList in ( { model | surveyResultList = surveyResultList, title = title } , Cmd.map Msg.SurveyResultList cmd @@ -80,19 +77,16 @@ update msg model = Route.init url navigation = - model.navigation - |> Navigation.updateRoute maybeRoute + Navigation.updateRoute maybeRoute model.navigation maybeChangeRoute = - maybeRoute - |> Cmd.maybeChangeRoute + Cmd.maybeChangeRoute maybeRoute in ( { model | navigation = navigation }, maybeChangeRoute ) Msg.UrlRequested urlRequest -> let changeUrl = - urlRequest - |> Cmd.changeUrl model.navigation.key + Cmd.changeUrl model.navigation.key urlRequest in ( model, changeUrl )