Weiterentwicklung Konsolenmenü
This commit is contained in:
parent
c617c886a1
commit
b777f4ad4f
@ -1,2 +1,6 @@
|
|||||||
1743966330
|
1743966330
|
||||||
1743966416
|
1743966416
|
||||||
|
1744018256
|
||||||
|
1744018315
|
||||||
|
1744018470
|
||||||
|
1744018696
|
||||||
|
@ -50,9 +50,9 @@ def stempel_zustand(filename):
|
|||||||
if lines == 0:
|
if lines == 0:
|
||||||
print(f"Keine Einträge")
|
print(f"Keine Einträge")
|
||||||
elif lines % 2 == 0:
|
elif lines % 2 == 0:
|
||||||
return("in")
|
return("ausgestempelt")
|
||||||
else:
|
else:
|
||||||
return("out")
|
return("eingestempelt")
|
||||||
|
|
||||||
# Stempelübersicht zusammenstellen
|
# Stempelübersicht zusammenstellen
|
||||||
def overview(filename):
|
def overview(filename):
|
||||||
@ -64,13 +64,23 @@ def overview(filename):
|
|||||||
in_times = []
|
in_times = []
|
||||||
out_times = []
|
out_times = []
|
||||||
|
|
||||||
for i in range(0, len(lines)-1):
|
for i in range(0, len(lines)):
|
||||||
if (i + 1) % 2 == 0:
|
if (i + 1) % 2 == 0:
|
||||||
out_times.append(lines[i])
|
out_times.append(lines[i])
|
||||||
else:
|
else:
|
||||||
in_times.append(lines[i])
|
in_times.append(lines[i])
|
||||||
for i in range(0, len(in_times) - 1):
|
if len(in_times) > len(out_times):
|
||||||
print(str(in_times[i]) + " - " + str(out_times[i]))
|
out_times.append("")
|
||||||
|
for i in range(0, len(in_times)):
|
||||||
|
print(convert_timestamp(in_times[i], "%d.%m.%Y %H:%M") + " - " + convert_timestamp(out_times[i], "%H:%M"))
|
||||||
|
|
||||||
|
|
||||||
|
# Timestamp konvertieren
|
||||||
|
def convert_timestamp(timestamp, format):
|
||||||
|
try:
|
||||||
|
return str(datetime.datetime.fromtimestamp(int(timestamp)).strftime(format))
|
||||||
|
except:
|
||||||
|
return ("...")
|
||||||
|
|
||||||
# Pfade bestimmen
|
# Pfade bestimmen
|
||||||
def scriptpath():
|
def scriptpath():
|
||||||
@ -97,13 +107,22 @@ def main():
|
|||||||
question = int(input("Geben Sie Ihre Antwort ein: "))
|
question = int(input("Geben Sie Ihre Antwort ein: "))
|
||||||
|
|
||||||
if question == 1:
|
if question == 1:
|
||||||
|
userlist = list_users(scriptpath() + "/" + userfolder)
|
||||||
|
print(userlist)
|
||||||
|
for i in range (0, len(userlist)):
|
||||||
|
print(str(i + 1) + ": " + str(userlist[i]))
|
||||||
|
|
||||||
which_user = input("Für welchen User soll gestempelt werden? ")
|
which_user = input("Für welchen User soll gestempelt werden? ")
|
||||||
append_timestamp(determine_filename(which_user))
|
append_timestamp(determine_filename(userlist[int(which_user) - 1]))
|
||||||
print("Stempeleintrag vorgenommen")
|
print("Stempeleintrag vorgenommen")
|
||||||
elif question == 2:
|
elif question == 2:
|
||||||
which_user = input("Für welchen User sollen die Stempelzeiten angezeigt werden?" )
|
userlist = list_users(scriptpath() + "/" + userfolder)
|
||||||
print("Zustand: " + stempel_zustand(determine_filename(which_user)))
|
for i in range (0, len(userlist)):
|
||||||
overview(determine_filename(which_user))
|
print(str(i + 1) + ": " + str(userlist[i]))
|
||||||
|
|
||||||
|
which_user = input("Für welchen User sollen die Stempelzeiten angezeigt werden? " )
|
||||||
|
print("Zustand: " + stempel_zustand(determine_filename(userlist[int(which_user) -1])))
|
||||||
|
overview(determine_filename(userlist[int(which_user) - 1]))
|
||||||
else:
|
else:
|
||||||
print("Keine Eingabe erkannt.")
|
print("Keine Eingabe erkannt.")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user