From 48714ca13fe61b0dc56458840bb73eca4f689386 Mon Sep 17 00:00:00 2001 From: San Jacobs Date: Mon, 25 Oct 2021 22:35:43 +0200 Subject: Considering adding date to the input prompt --- satscalc.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/satscalc.py b/satscalc.py index f118fbe..2e71d3f 100755 --- a/satscalc.py +++ b/satscalc.py @@ -1,6 +1,12 @@ #!/usr/bin/env python3 import datetime +# NOTE: Maybe the whole thing should be re-thought to actually prompt for date. +# That way you can easily fill in a calendar of sorts, which is much easier to loop through and calculate what hours were overtime etc. +# This can probably be done with some smarts, which assume that if you start at 08:00, 07:00 doesn't mean the same day. +# Meaning you only need to prompt for the date of the call time, not the date of the wrap time. +# This will also automatically let you know if it was a weekend and stuff like that. + # TODO: Prompt user for base rate, call time, wrap time, whether overtime was warned, and if it was a weekend. # This should be enough to calculate the pay for a single day's work. @@ -48,9 +54,24 @@ while True: weekend = "y" in input("Was this a weekend? [y/n]: ").lower() - if hours_worked > 8: + overtime = hours_worked > 8 + if overtime: + overtime_hours = hours_worked-8 print("Overtime detected.") warned_overtime = "y" in input("Was this overtime warned about before 12 o'clock the day before? [y/n]: ").lower() + +# --- Price calculation --- + +# Notes: +# First two hours of warned overtime are 50%, unwarned is 100% +# Any work after 20:00 is overtime +# + +# Extremely naive calculation +sum = 0 +if overtime: + sum += overtime_hours*(hourly_rate*1.5) + print("\nDifference:", difference) print("Hours worked:", hours_worked) -- cgit v1.2.1