Merge branch 'master' into styling
This commit is contained in:
commit
41f67aa5c8
@ -17,7 +17,6 @@ ENV LANGUAGE de_DE:de
|
|||||||
ENV LC_ALL de_DE.UTF-8
|
ENV LC_ALL de_DE.UTF-8
|
||||||
|
|
||||||
COPY main.py /app/main.py
|
COPY main.py /app/main.py
|
||||||
COPY favicon.svg /app/favicon.svg
|
|
||||||
COPY lib /app/lib/
|
COPY lib /app/lib/
|
||||||
EXPOSE 8090
|
EXPOSE 8090
|
||||||
ENTRYPOINT ["/.venv/bin/python", "/app/main.py"]
|
ENTRYPOINT ["/.venv/bin/python", "/app/main.py"]
|
||||||
|
@ -4,8 +4,11 @@ services:
|
|||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- 8090:8090
|
- 8090:8090
|
||||||
|
environment:
|
||||||
|
- PYTHONUNBUFFERED=1
|
||||||
volumes:
|
volumes:
|
||||||
#- /home/alexander/Dokumente/Python/Zeiterfassung:/app
|
#- /home/alexander/Dokumente/Python/Zeiterfassung/lib:/app/lib
|
||||||
|
#- /home/alexander/Dokumente/Python/Zeiterfassung/main.py:/app/main.py
|
||||||
- /home/alexander/Dokumente/Python/Zeiterfassung/docker-work/users:/users
|
- /home/alexander/Dokumente/Python/Zeiterfassung/docker-work/users:/users
|
||||||
- /home/alexander/Dokumente/Python/Zeiterfassung/docker-work/backup:/backup
|
- /home/alexander/Dokumente/Python/Zeiterfassung/docker-work/backup:/backup
|
||||||
- /home/alexander/Dokumente/Python/Zeiterfassung/docker-work/settings:/settings
|
- /home/alexander/Dokumente/Python/Zeiterfassung/docker-work/settings:/settings
|
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
@ -74,7 +74,7 @@ def homepage():
|
|||||||
#time_toggle = ui.toggle({"day": "Tagesarbeitszeit", "total": "Gesamtzeit"}, value="day",
|
#time_toggle = ui.toggle({"day": "Tagesarbeitszeit", "total": "Gesamtzeit"}, value="day",
|
||||||
# on_change=update_timer).classes('w-full justify-center col-span-2 normal-case').tooltip("Hier lässt sich die Anzeige oben zwischen heute geleisteter Arbeitszeit und summierter Arbeitszeit umschalten.")
|
# on_change=update_timer).classes('w-full justify-center col-span-2 normal-case').tooltip("Hier lässt sich die Anzeige oben zwischen heute geleisteter Arbeitszeit und summierter Arbeitszeit umschalten.")
|
||||||
|
|
||||||
working_timer = ui.timer(1.0, update_timer)
|
working_timer = ui.timer(30.0, update_timer)
|
||||||
working_timer.active = False
|
working_timer.active = False
|
||||||
|
|
||||||
if current_user.stamp_status() == status_in:
|
if current_user.stamp_status() == status_in:
|
||||||
@ -170,7 +170,6 @@ def homepage():
|
|||||||
note_dict["user"] = daynote.value
|
note_dict["user"] = daynote.value
|
||||||
nonlocal last_selection
|
nonlocal last_selection
|
||||||
last_selection = day_selector.value
|
last_selection = day_selector.value
|
||||||
print(f"Last selection from save: {last_selection}")
|
|
||||||
if day_selector.value == 0:
|
if day_selector.value == 0:
|
||||||
day_to_write = today.day
|
day_to_write = today.day
|
||||||
else:
|
else:
|
||||||
|
32
lib/users.py
32
lib/users.py
@ -136,10 +136,15 @@ class user:
|
|||||||
outputfile.write(json_dict)
|
outputfile.write(json_dict)
|
||||||
|
|
||||||
pathcheck = self.userfolder
|
pathcheck = self.userfolder
|
||||||
pathcheck = pathcheck.removeprefix(os.path.join(scriptpath, userfolder))
|
if not is_docker():
|
||||||
|
pathcheck = pathcheck.removeprefix(os.path.join(scriptpath, userfolder))
|
||||||
|
if pathcheck != self.username:
|
||||||
|
os.rename(self.userfolder, os.path.join(scriptpath, userfolder, self.username))
|
||||||
|
else:
|
||||||
|
pathcheck = pathcheck.removeprefix("/users")
|
||||||
|
if pathcheck != self.username:
|
||||||
|
os.rename(self.userfolder, os.path.join(userfolder, self.username))
|
||||||
|
|
||||||
if pathcheck != self.username:
|
|
||||||
os.rename(self.userfolder, os.path.join(scriptpath, userfolder, self.username))
|
|
||||||
|
|
||||||
def del_user(self):
|
def del_user(self):
|
||||||
shutil.rmtree(self.userfolder)
|
shutil.rmtree(self.userfolder)
|
||||||
@ -304,10 +309,27 @@ class user:
|
|||||||
return { }
|
return { }
|
||||||
|
|
||||||
def write_notes(self, year, month, day, note_dict):
|
def write_notes(self, year, month, day, note_dict):
|
||||||
with open(os.path.join(self.userfolder, f"{int(year)}-{int(month)}.json"), "r") as json_file:
|
try:
|
||||||
json_data = json.load(json_file)
|
with open(os.path.join(self.userfolder, f"{int(year)}-{int(month)}.json"), "r") as json_file:
|
||||||
|
json_data = json.load(json_file)
|
||||||
|
except FileNotFoundError:
|
||||||
|
dict = {}
|
||||||
|
dict["archived"] = 0
|
||||||
|
dict["total_hours"] = 0
|
||||||
|
dict["notes"] = { }
|
||||||
|
|
||||||
|
json_dict = json.dumps(dict, indent=4)
|
||||||
|
with open(os.path.join(self.userfolder, f"{int(year)}-{int(month)}.json"), 'w') as json_file:
|
||||||
|
json_file.write(json_dict)
|
||||||
|
|
||||||
|
json_data = dict
|
||||||
|
|
||||||
if len(note_dict) == 1:
|
if len(note_dict) == 1:
|
||||||
user_info = list(note_dict)[0]
|
user_info = list(note_dict)[0]
|
||||||
|
try:
|
||||||
|
json_data["notes"]
|
||||||
|
except KeyError:
|
||||||
|
json_data["notes"] = { }
|
||||||
json_data["notes"][str(day)] = { }
|
json_data["notes"][str(day)] = { }
|
||||||
json_data["notes"][str(day)][user_info] = note_dict[user_info]
|
json_data["notes"][str(day)][user_info] = note_dict[user_info]
|
||||||
if json_data["notes"][str(day)][user_info] == "":
|
if json_data["notes"][str(day)][user_info] == "":
|
||||||
|
6
main.py
6
main.py
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# Zeiterfassung
|
# Zeiterfassung
|
||||||
|
import os.path
|
||||||
|
|
||||||
from lib.web_ui import *
|
from lib.web_ui import *
|
||||||
from lib.admin import *
|
from lib.admin import *
|
||||||
@ -172,8 +173,11 @@ def main():
|
|||||||
</svg
|
</svg
|
||||||
>
|
>
|
||||||
'''
|
'''
|
||||||
|
if not os.path.exists(os.path.join(scriptpath, "favicon.svg")):
|
||||||
|
with open(os.path.join(scriptpath, "favicon.svg"), 'w') as favicon_file:
|
||||||
|
favicon_file.write(favicon)
|
||||||
|
|
||||||
ui.run(favicon=favicon, port=port, storage_secret=secret, language='de-DE', show_welcome_message=False)
|
ui.run(favicon=os.path.join(scriptpath, "favicon.svg"), port=port, storage_secret=secret, language='de-DE', show_welcome_message=False)
|
||||||
|
|
||||||
if __name__ in ("__main__", "__mp_main__"):
|
if __name__ in ("__main__", "__mp_main__"):
|
||||||
parser = argparse.ArgumentParser(description=f'{app_title} {app_version}')
|
parser = argparse.ArgumentParser(description=f'{app_title} {app_version}')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user