From b774ec6e1e06b8c111bae1a94530bb75b632bfdb Mon Sep 17 00:00:00 2001 From: anima Date: Fri, 4 Jun 2021 21:15:47 +0200 Subject: [PATCH] add readme.md --- README.md | 24 +++++++++++++++++++ timeTrack.py | 66 +++++++++++++++++++++++++++------------------------- 2 files changed, 58 insertions(+), 32 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..26294e0 --- /dev/null +++ b/README.md @@ -0,0 +1,24 @@ +# Timetrack +Simple time tracking + +## Requirements +- Python 3.9 or higher + +## Usage +*as of v.2.0.2a* +Start the script and follow the menu. +Currently no further usability. + +## Agenda +- [ ] Reports + - [ ] by day + - [ ] by week + - [ ] by month + - [ ] by user +- [ ] Manual time entries +- [ ] Break in time entries +- [ ] User management +- [ ] Categories +- [ ] Clients +- [ ] References +- [ ] GUI \ No newline at end of file diff --git a/timeTrack.py b/timeTrack.py index 3755ea0..ed43b6d 100644 --- a/timeTrack.py +++ b/timeTrack.py @@ -1,9 +1,9 @@ -#!/bin/python3 +#!/usr/bin/env python3 ######################### # # timeTrack.py # by 4nima -# v.2.0.0 +# v.2.0.2 # ######################### # simple time tracking with database @@ -348,24 +348,24 @@ class TimeTrack: logging.debug('Event younger than 1 day') print('Vergangene Zeit: >{} Stunden'.format(int(elapsed.seconds/3600))) - userinput = '' - while True: - if userinput == "F" or userinput == "f" or userinput == "1" \ - or userinput == "L" or userinput == "l" or userinput == "2" \ - or userinput == "A" or userinput == "a" or userinput == "3": - break + userinput = 0 + while not 0 < int(userinput) < 4: print('Soll das Event fortgesetzt oder gelöscht werden?') - print('[1/F/f] für fortsetzen') - print('[2/L/l] für löschen') - print('[3/A/a] für abbrechen') + print('[1] für fortsetzen') + print('[2] für löschen') + print('[3] für abbrechen') userinput = input('Aktion: ') logging.debug('User input: {}'.format(userinput)) + try: + int(userinput) + except ValueError: + userinput = 0 self.clear_screen() - if userinput == "F" or userinput == "f" or userinput == "1": + if userinput == "1": logging.debug('Event should be continued') self.time_stop() - elif userinput == "L" or userinput == "l" or userinput == "2": + elif userinput == "2": logging.info('Event should be deleted (eventid: {})'.format(data[0])) self.delete_event(data[0]) self.time_start() @@ -383,21 +383,21 @@ class TimeTrack: logging.debug('Event stop progess is started') if data: self.clear_screen() - userinput = '' - while True: - if userinput == "B" or userinput == "b" or userinput == "1" \ - or userinput == "L" or userinput == "l" or userinput == "2" \ - or userinput == "A" or userinput == "a" or userinput == "3": - break + userinput = 0 + while not 0 < int(userinput) < 4: print('Event von {} Uhr beenden?'.format(data[1].strftime("%H:%M"))) - print('[1/B/b] für beenden') - print('[2/L/l] für löschen') - print('[3/A/a] für abbrechen') + print('[1] für beenden') + print('[2] für löschen') + print('[3] für abbrechen') userinput = input('Aktion: ') logging.debug('User input: {}'.format(userinput)) + try: + int(userinput) + except ValueError: + userinput = 0 self.clear_screen() - if userinput == "B" or userinput == "b" or userinput == "1": + if userinput == "1": logging.debug('Event is ended') print('Eingabe beenden mittels doppelter Leerzeile.') print('Durchgeführte Tätigkeiten:') @@ -438,18 +438,20 @@ class TimeTrack: self.delete_event(data[0]) self.print_time_entry(STARTTIME=data[1], ENDTIME=endtime, ACTIVITY=action) print('Zeiteintrag wurde gespeichert.') - while True: - if userinput == "J" or userinput == "j" or userinput == "1" \ - or userinput == "N" or userinput == "n" or userinput == "2": - break - print('Nächsten Zeiteintrag begrinnen ?') - print('[1/J/j] Ja') - print('[2/N/n] Nein') + userinput = 0 + while not 0 < int(userinput) < 3: + print('Nächsten Zeiteintrag beginnen ?') + print('[1] Ja') + print('[2] Nein') userinput = input('Aktion: ') logging.debug('User input: {}'.format(userinput)) + try: + int(userinput) + except ValueError: + userinput = 0 self.clear_screen() - if userinput == "J" or userinput == "j" or userinput == "1": + if userinput == "1": self.time_start() else: logging.debug('Terminated by the user') @@ -458,7 +460,7 @@ class TimeTrack: connect.close() - elif userinput == "L" or userinput == "l" or userinput == "2": + elif userinput == "2": logging.info('Event should be deleted (eventid: {})'.format(data[0])) self.delete_event(data[0]) else: