Skip to content

Instantly share code, notes, and snippets.

@richardlehane
Created September 15, 2010 10:18
Show Gist options
  • Save richardlehane/580526 to your computer and use it in GitHub Desktop.
Save richardlehane/580526 to your computer and use it in GitHub Desktop.
class PunchCard:
hourly_rate = 47.82
notify_interval = 3600.0
shift_start = 0
lunch_start = 0
lunch_mins = 0
timer = 0
def calculate_cost():
start = to_mins(shift_start)
now = to_mins(rounded_time())
mins = start - now - self.lunch
cost = dbl(hourly_rate/60 * mins)
def trigger_lunch():
if self.lunch_start:
else:
self.lunch_start = self.rounded_time()
def notify()
def trigger_notify():
if self.timer:
self.timer = 0
else:
notify()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment