42 lines
844 B
Python
42 lines
844 B
Python
''' Dayclass wich represents a day at work '''
|
|
|
|
from calculation import hoursSpent
|
|
from datetime import datetime
|
|
from time import sleep
|
|
|
|
|
|
class Day:
|
|
|
|
def __init__(self):
|
|
self.begin = 0
|
|
self.end = 0
|
|
self.begin_break = 0
|
|
self.end_break = 0
|
|
self.duration = 0
|
|
|
|
def beginDay(self):
|
|
self.begin = datetime.now()
|
|
print(self.begin)
|
|
|
|
def make_break(self):
|
|
self.begin_break = datetime.now()
|
|
|
|
def go_on(self):
|
|
self.end_break = datetime.now()
|
|
|
|
def endDay(self):
|
|
self.end = datetime.now()
|
|
self.duration = hoursSpent(
|
|
self.begin, self.end, self.begin_break, self.end_break)
|
|
|
|
|
|
first_day = Day()
|
|
first_day.beginDay()
|
|
sleep(1)
|
|
first_day.make_break()
|
|
sleep(2)
|
|
first_day.go_on()
|
|
sleep(10)
|
|
first_day.endDay()
|
|
print("worked", first_day.duration)
|