diff --git a/config.yml b/config.yml index b77418f..31413ae 100644 --- a/config.yml +++ b/config.yml @@ -1,11 +1,13 @@ # Each career has roles defined in # https://github.com/teamniteo/handbook/blob/master/5_People/salary-system.md#roles # + # For each role, we get the median US salary from Salary.com, which # is annual amount in USD, we divide it by 12 and further divide it # by the 10-year average of EUR -> USD exchange rate from ofx.com. # We get a monthly base salary in EUR. eur_to_usd_10_year_avg: 1.188703 +careers_updated: '2023-13-31' careers: - name: Design @@ -113,6 +115,7 @@ careers: # for exact details on these calculations. affordability: 0.49 +countries_updated: '2023-12-30' countries: - name: Albania diff --git a/scripts/fetch_config_values.py b/scripts/fetch_config_values.py index 6517581..e749949 100644 --- a/scripts/fetch_config_values.py +++ b/scripts/fetch_config_values.py @@ -1,5 +1,6 @@ """Use a real browser to fetch config.yaml values.""" +from datetime import date from ruamel.yaml import RoundTripDumper from ruamel.yaml import RoundTripLoader from selenium import webdriver @@ -117,6 +118,7 @@ def countries( compress_towards_affordability(numbeo_ratio, config["affordability"]), 2 ) + config["countries_updated"] = date.today().isoformat() pbar.close() @@ -148,6 +150,7 @@ def salaries( base_salary = round(us_salary / 12 / config["eur_to_usd_10_year_avg"]) role["baseSalary"] = base_salary + config["careers_updated"] = date.today().isoformat() pbar.close() diff --git a/src/Config.elm b/src/Config.elm index abe71db..ccf6556 100644 --- a/src/Config.elm +++ b/src/Config.elm @@ -17,6 +17,8 @@ import Json.Decode as Decode type alias Config = { countries : List Country , careers : List Career + , countries_updated : String + , careers_updated : String } @@ -58,10 +60,12 @@ type alias Config = -} configDecoder : Decode.Decoder Config configDecoder = - Decode.map2 + Decode.map4 Config (Decode.field "countries" countriesDecoder) (Decode.field "careers" careersDecoder) + (Decode.field "careers_updated" Decode.string) + (Decode.field "countries_updated" Decode.string) {-| A helper for configDecoder diff --git a/src/Main.elm b/src/Main.elm index c0b510f..e616db6 100644 --- a/src/Main.elm +++ b/src/Main.elm @@ -64,6 +64,8 @@ init flags = , roleDropdown = Dropdown.initialState , countryDropdown = Dropdown.initialState , tenureDropdown = Dropdown.initialState + , careers_updated = "1999-01-01" + , countries_updated = "1999-01-01" } Ok config -> @@ -165,6 +167,8 @@ init flags = , roleDropdown = Dropdown.initialState , countryDropdown = Dropdown.initialState , tenureDropdown = Dropdown.initialState + , careers_updated = config.careers_updated + , countries_updated = config.countries_updated } in ( model @@ -218,6 +222,8 @@ type alias Model = , roleDropdown : Dropdown.State , countryDropdown : Dropdown.State , tenureDropdown : Dropdown.State + , careers_updated : String + , countries_updated : String } @@ -334,7 +340,7 @@ view model = ( Just role, Just country ) -> [ Accordion.block [] [ Block.text [] - [ viewBreakdown role country model.tenure ] + [ viewBreakdown role country model.tenure model.careers_updated model.countries_updated ] ] ] } @@ -507,8 +513,8 @@ viewSalary maybeRole maybeCountry tenure = ] -viewBreakdown : Role -> Country -> Int -> Html Msg -viewBreakdown role country tenure = +viewBreakdown : Role -> Country -> Int -> String -> String -> Html Msg +viewBreakdown role country tenure careers_updated countries_updated = div [] [ table [ class "table" ] [ tr [] @@ -600,7 +606,10 @@ viewBreakdown role country tenure = [ text "Base Salary: " ] , text "US median for " , mark [] [ text role.name ] - , text " on Salary.com, divided by 12 (months) and converted to EUR using a 10-year USD -> EUR average." + , text " on Salary.com, divided by 12 (months) and converted to EUR using a 10-year USD -> EUR average. " + , text "This value was fetched from Salary.com on " + , mark [] [ text careers_updated ] + , text "." ] , ListGroup.li [] [ span @@ -609,7 +618,10 @@ viewBreakdown role country tenure = [ text "Compressed Cost of Living: " ] , text "Numbeo Cost of Living in " , mark [] [ text country.name ] - , text " compared to United States, compressed against our Affordability Ratio of 0.49." + , text " compared to United States, compressed against our Affordability Ratio of 0.49. " + , text "This value was fetched from Numbeo on " + , mark [] [ text countries_updated ] + , text "." ] , ListGroup.li [] [ span