28 lines
851 B
Python
28 lines
851 B
Python
# Zeiterfassung
|
|
# Benutzerfunktionen
|
|
|
|
import os
|
|
import time
|
|
import datetime
|
|
|
|
from definitions import *
|
|
|
|
# Benutzer anhand Verzeichnisse auflisten
|
|
def list_users(directory):
|
|
users = [d for d in os.listdir(directory) if os.path.isdir(os.path.join(directory, d))]
|
|
return users
|
|
|
|
def determine_filename(user, type="stamping"):
|
|
if type == "stamping":
|
|
year = str(datetime.datetime.now().year)
|
|
month = str(datetime.datetime.now().month)
|
|
completepath = scriptpath() + "/" + userfolder +"/" + user + "/" + year + "-" + month + ".txt"
|
|
return completepath
|
|
elif type == "settings":
|
|
completepath = scriptpath() + "/" + userfolder +"/" + user + "/" + usersettingsfilename
|
|
return completepath
|
|
|
|
# Installationsverzeichnis bestimmen
|
|
def scriptpath():
|
|
|
|
return os.path.dirname(os.path.abspath(__file__)) |