Skip to content

Commit

Permalink
Fix City of Seattle hourly rate conversion (#78)
Browse files Browse the repository at this point in the history
* Fix City of Seattle hourly rate conversion

* Simplify cleaning logic
  • Loading branch information
AetherUnbound authored Feb 11, 2022
1 parent 171a417 commit a56442d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ def _augment_with_salary_cached(last: Optional[str], first: Optional[str]) -> st
if not results:
return ""
s = results[0]
projected = Decimal(s["hourly_rate"]) * 40 * 50
hourly_rate = s["hourly_rate"]
# City of Seattle wage data formats rate as "$ <number>" for some
# horrible reason, so we clean this data a bit for decimal conversion.
if isinstance(hourly_rate, str):
hourly_rate = hourly_rate.strip("$ ")
s["hourly_rate"] = hourly_rate
projected = Decimal(hourly_rate) * 40 * 50
# Format with commas
context = {**s, "projected": f"{projected:,}"}
return render_template("extras/seattle-salary.html", **context)
Expand Down

0 comments on commit a56442d

Please sign in to comment.