Compare commits
2 Commits
7fbad1ee4a
...
53d0f8d83f
| Author | SHA1 | Date | |
|---|---|---|---|
| 53d0f8d83f | |||
| 57bbfc77dc |
41
timeTrack.py
41
timeTrack.py
@@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# timeTrack.py
|
# timeTrack.py
|
||||||
# by 4nima
|
# by 4nima
|
||||||
# v.2.1.1
|
# v.2.1.2
|
||||||
#
|
#
|
||||||
#########################
|
#########################
|
||||||
# simple time tracking with database
|
# simple time tracking with database
|
||||||
@@ -93,6 +93,7 @@ class TimeTrack:
|
|||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
starttime TIMESTAMP NOT NULL,
|
starttime TIMESTAMP NOT NULL,
|
||||||
endtime TIMESTAMP NOT NULL,
|
endtime TIMESTAMP NOT NULL,
|
||||||
|
breaktime1 TIMESTAMP,
|
||||||
user_id INTEGER NOT NULL,
|
user_id INTEGER NOT NULL,
|
||||||
activity TEXT,
|
activity TEXT,
|
||||||
reference TEXT,
|
reference TEXT,
|
||||||
@@ -106,6 +107,7 @@ class TimeTrack:
|
|||||||
CREATE TABLE IF NOT EXISTS active_events (
|
CREATE TABLE IF NOT EXISTS active_events (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
starttime TIMESTAMP NOT NULL,
|
starttime TIMESTAMP NOT NULL,
|
||||||
|
breaktime TIMESTAMP,
|
||||||
user_id INT NOT NULL
|
user_id INT NOT NULL
|
||||||
)
|
)
|
||||||
""")
|
""")
|
||||||
@@ -434,8 +436,6 @@ class TimeTrack:
|
|||||||
logging.info('Event should be deleted (eventid: {})'.format(data[0]))
|
logging.info('Event should be deleted (eventid: {})'.format(data[0]))
|
||||||
self.delete_event(data[0])
|
self.delete_event(data[0])
|
||||||
self.time_start()
|
self.time_start()
|
||||||
else:
|
|
||||||
self.start_interactive_mode()
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logging.debug('Event continues (eventid{})'.format(data[0]))
|
logging.debug('Event continues (eventid{})'.format(data[0]))
|
||||||
@@ -509,14 +509,10 @@ class TimeTrack:
|
|||||||
|
|
||||||
if userinput == 1:
|
if userinput == 1:
|
||||||
self.time_start()
|
self.time_start()
|
||||||
else:
|
|
||||||
self.start_interactive_mode()
|
|
||||||
|
|
||||||
elif userinput == 2:
|
elif userinput == 2:
|
||||||
logging.info('Event should be deleted (eventid: {})'.format(data[0]))
|
logging.info('Event should be deleted (eventid: {})'.format(data[0]))
|
||||||
self.delete_event(data[0])
|
self.delete_event(data[0])
|
||||||
else:
|
|
||||||
self.start_interactive_mode()
|
|
||||||
|
|
||||||
## Interactive mode
|
## Interactive mode
|
||||||
#==================
|
#==================
|
||||||
@@ -524,10 +520,11 @@ class TimeTrack:
|
|||||||
def start_interactive_mode(self):
|
def start_interactive_mode(self):
|
||||||
self.clear_screen()
|
self.clear_screen()
|
||||||
printtext = [
|
printtext = [
|
||||||
|
'=> Hauptmenü - Angemeldet als {}'.format(self.USERNAME),
|
||||||
'Was willst du tun?',
|
'Was willst du tun?',
|
||||||
'[1] Zeiterfassung starten',
|
'[1] Zeiterfassung starten',
|
||||||
'[2] heutiger Report',
|
'[2] heutiger Report',
|
||||||
'[3] Report für Tag x',
|
'[3] Benutzerverwaltung',
|
||||||
'[0] Programm verlassen'
|
'[0] Programm verlassen'
|
||||||
]
|
]
|
||||||
userinput = self.userchoise(printtext, 4)
|
userinput = self.userchoise(printtext, 4)
|
||||||
@@ -539,16 +536,34 @@ class TimeTrack:
|
|||||||
logging.info('Print todays report')
|
logging.info('Print todays report')
|
||||||
self.report_by_day(DETAIL=True)
|
self.report_by_day(DETAIL=True)
|
||||||
input()
|
input()
|
||||||
self.start_interactive_mode()
|
|
||||||
elif userinput == 3:
|
elif userinput == 3:
|
||||||
print('commig soon ...')
|
self.interactive_usermanagment()
|
||||||
input()
|
|
||||||
self.start_interactive_mode()
|
|
||||||
elif userinput == 4:
|
elif userinput == 4:
|
||||||
print('commig soon ...')
|
print('commig soon ...')
|
||||||
input()
|
input()
|
||||||
|
else:
|
||||||
|
exit()
|
||||||
self.start_interactive_mode()
|
self.start_interactive_mode()
|
||||||
|
|
||||||
|
def interactive_usermanagment(self):
|
||||||
|
self.clear_screen()
|
||||||
|
printtext = [
|
||||||
|
'==> Benutzerverwaltung - Angemeldet als {}'.format(self.USERNAME),
|
||||||
|
'Was willst du tun?',
|
||||||
|
'[1] Benutzer anlegen',
|
||||||
|
'[2] Benutzer wechseln',
|
||||||
|
'[3] Benutzer löschen',
|
||||||
|
'[0] abbrechen'
|
||||||
|
]
|
||||||
|
userinput = self.userchoise(printtext, 4)
|
||||||
|
|
||||||
|
if userinput == 1:
|
||||||
|
self.create_user()
|
||||||
|
elif userinput == 2:
|
||||||
|
pass
|
||||||
|
elif userinput == 3:
|
||||||
|
pass
|
||||||
|
|
||||||
## Reports
|
## Reports
|
||||||
#=========
|
#=========
|
||||||
### One day report, optionally with time entries
|
### One day report, optionally with time entries
|
||||||
@@ -591,8 +606,6 @@ class TimeTrack:
|
|||||||
if userinput == 1:
|
if userinput == 1:
|
||||||
for entry in timedata:
|
for entry in timedata:
|
||||||
self.print_time_entry(entry[1], entry[2], entry[4])
|
self.print_time_entry(entry[1], entry[2], entry[4])
|
||||||
else:
|
|
||||||
self.start_interactive_mode()
|
|
||||||
|
|
||||||
## Outputs
|
## Outputs
|
||||||
#=========
|
#=========
|
||||||
|
|||||||
Reference in New Issue
Block a user