Skip to content

Commit

Permalink
Show when salaries and countries values were last updated
Browse files Browse the repository at this point in the history
  • Loading branch information
zupo committed Feb 6, 2024
1 parent 33b9fb9 commit 192c626
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
3 changes: 3 additions & 0 deletions config.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -113,6 +115,7 @@ careers:
# for exact details on these calculations.

affordability: 0.49
countries_updated: '2023-12-30'
countries:

- name: Albania
Expand Down
3 changes: 3 additions & 0 deletions scripts/fetch_config_values.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -117,6 +118,7 @@ def countries(
compress_towards_affordability(numbeo_ratio, config["affordability"]), 2
)

config["countries_updated"] = date.today().isoformat()
pbar.close()


Expand Down Expand Up @@ -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()


Expand Down
6 changes: 5 additions & 1 deletion src/Config.elm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import Json.Decode as Decode
type alias Config =
{ countries : List Country
, careers : List Career
, countries_updated : String
, careers_updated : String
}


Expand Down Expand Up @@ -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
Expand Down
22 changes: 17 additions & 5 deletions src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -218,6 +222,8 @@ type alias Model =
, roleDropdown : Dropdown.State
, countryDropdown : Dropdown.State
, tenureDropdown : Dropdown.State
, careers_updated : String
, countries_updated : String
}


Expand Down Expand Up @@ -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 ]
]
]
}
Expand Down Expand Up @@ -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 []
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 192c626

Please sign in to comment.