From c6268104030a939b280a953d98a7fd1ce55fbc0e Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 5 Mar 2023 20:25:47 +0100 Subject: [PATCH] Add relative surplus display. --- income_progress_bars.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/income_progress_bars.py b/income_progress_bars.py index 8a85a4c..5a4f5ad 100644 --- a/income_progress_bars.py +++ b/income_progress_bars.py @@ -25,6 +25,9 @@ td, th { background-color: black; border: none; } +.surplusbar { + width: 200px; +} .time_progress { position: absolute; height: 20px; @@ -212,7 +215,9 @@ class MyServer(BaseHTTPRequestHandler): success_income_cut = min(success_income, 1.0) success_income_bonus = max(success_income - 1.0, 0) success = success_income + 0 - diff_goal = earned - goal + diff_goal = "%.2f€" % (earned - goal) + if title != "workday": + diff_goal += "(%.2f€)" % (earned - (goal * time_progress)) if time_progress >= 0: success = 1 if time_progress > 0: @@ -221,7 +226,7 @@ class MyServer(BaseHTTPRequestHandler): return "%s" \ "%.2f€" \ "%s
" \ - "
%.2f€
" % ( + "
%s
" % ( title, earned, time_progress_indicator, success_color(success), int(success_income_cut * 100), diff_goal, int(success_income_bonus * 100)) day_income = (db["workday_minutes_worked_1"] / 60.0) * db["workday_hourly_rate_1"] day_income += (db["workday_minutes_worked_2"] / 60.0) * db["workday_hourly_rate_2"] -- 2.30.2