Summenabschnitt API hinzugefügt
Zeitsollbestimmung hat noch Fehler
This commit is contained in:
parent
df81a05a7f
commit
005d5be686
38
api.py
38
api.py
@ -15,7 +15,7 @@ import calendar
|
||||
@ui.page('/api/overview/month/{username}-{year}-{month}')
|
||||
def page(username: str, year: int, month: int):
|
||||
|
||||
#try:
|
||||
try:
|
||||
current_user = user(username)
|
||||
ui.page_title(f"Bericht für {current_user.fullname} für {calendar.month_name[month]} {year}")
|
||||
ui.label(datetime.now().strftime('%d.%m.%Y')).classes('absolute top-5 right-5')
|
||||
@ -65,8 +65,7 @@ def page(username: str, year: int, month: int):
|
||||
for i in list(user_absent):
|
||||
if int(i) == day:
|
||||
booking_text += absence_entries[user_absent[i]]["name"] + " "
|
||||
except Exception as e:
|
||||
print(e)
|
||||
except:
|
||||
pass
|
||||
|
||||
# Buchungen behandeln
|
||||
@ -130,6 +129,7 @@ def page(username: str, year: int, month: int):
|
||||
if time_duty < 0:
|
||||
saldo = 0
|
||||
total = ""
|
||||
booking_text = "Kein Arbeitsverhältnis"
|
||||
else:
|
||||
saldo = int(time_sum) - int(time_duty)
|
||||
# Nach Abwesenheitseinträgen suchen
|
||||
@ -147,20 +147,30 @@ def page(username: str, year: int, month: int):
|
||||
|
||||
rows.append({'date': current_day_date, 'bookings': booking_text, 'is_time': is_time, 'target_time': target_time, 'total': total})
|
||||
|
||||
|
||||
|
||||
|
||||
#rows = [
|
||||
# {'date': '1.1.2024', 'bookings': '12345', 'is_time': '12345', 'target_time': '98765', 'total': 123}
|
||||
#]
|
||||
|
||||
overview_table = ui.table(columns=columns, rows=rows).classes('w-120')
|
||||
# Zeilenumbruch umsetzen
|
||||
overview_table.add_slot('body-cell', r'''
|
||||
<td :props="props" :style="{'white-space':'pre-line'}">{{ props.value }}</td>
|
||||
''')
|
||||
|
||||
#except Exception as e:
|
||||
# print(e)
|
||||
# ui.markdown('#Fehler')
|
||||
# ui.markdown('Benutzer existiert nicht')
|
||||
# Überstundenzusammenfassung
|
||||
|
||||
with ui.grid(columns=2).classes('w-full gap-0'):
|
||||
ui.markdown("Überstunden aus Vormonat:")
|
||||
last_months_overtime = current_user.get_last_months_overtime(year, month)
|
||||
ui.markdown(f"{convert_seconds_to_hours(last_months_overtime)} h")
|
||||
ui.markdown("Überstunden diesen Monat:")
|
||||
ui.markdown(f"{convert_seconds_to_hours(general_saldo)} h")
|
||||
ui.markdown("**Überstunden Gesamt:**")
|
||||
overtime_overall = last_months_overtime + general_saldo
|
||||
ui.markdown(f"**{convert_seconds_to_hours(overtime_overall)} h**")
|
||||
|
||||
except Exception as e:
|
||||
print(str(type(e).__name__) + " " + str(e))
|
||||
if type(e) == UnboundLocalError:
|
||||
ui.markdown('#Fehler')
|
||||
ui.markdown('Benutzer existiert nicht')
|
||||
else:
|
||||
ui.markdown('#Fehler')
|
||||
ui.markdown(str(type(e)))
|
||||
ui.markdown(str(e))
|
@ -3,16 +3,6 @@
|
||||
"fullname": "Pia Paulina",
|
||||
"password": "123456789",
|
||||
"workhours": {
|
||||
"2025-04-03": {
|
||||
"1": "4",
|
||||
"2": "8",
|
||||
"3": "8",
|
||||
"4": "8",
|
||||
"5": "8",
|
||||
"6": "0",
|
||||
"7": "0",
|
||||
"vacation": "35"
|
||||
},
|
||||
"2025-05-13": {
|
||||
"1": "0",
|
||||
"2": "0",
|
||||
@ -32,6 +22,16 @@
|
||||
"6": "6",
|
||||
"7": "7",
|
||||
"vacation": "0"
|
||||
},
|
||||
"2025-03-01": {
|
||||
"1": "4",
|
||||
"2": "8",
|
||||
"3": "8",
|
||||
"4": "8",
|
||||
"5": "8",
|
||||
"6": 0,
|
||||
"7": 0,
|
||||
"vacation": "30"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user