X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=income_progress_bars.py;h=1ecd8b9a14452b0bc352084ef98ca7f4a8955140;hb=957b289c36c522e19916ef474f14a70caeab0c17;hp=8a85a4c5a7402ff791a47a033678f1f6c352d1f7;hpb=6115737776cbf6ebd486de1849ea16272cdaff1a;p=misc diff --git a/income_progress_bars.py b/income_progress_bars.py index 8a85a4c..1ecd8b9 100644 --- a/income_progress_bars.py +++ b/income_progress_bars.py @@ -3,7 +3,7 @@ import os import json hostName = "localhost" -serverPort = 8080 +serverPort = 8081 header = """ @@ -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"] @@ -252,7 +257,7 @@ class MyServer(BaseHTTPRequestHandler): if __name__ == "__main__": webServer = HTTPServer((hostName, serverPort), MyServer) - print("Server started http://%s:%s" % (hostName, serverPort)) + print(f"Server started http://{hostName}:{serverPort}") try: webServer.serve_forever() except KeyboardInterrupt: