restructuring

This commit is contained in:
2024-06-19 14:55:39 +02:00
parent bf76c368c9
commit 6fa1c5a4c3
5 changed files with 36 additions and 32 deletions

16
util/views.py Normal file
View File

@@ -0,0 +1,16 @@
from model.TimeSlot import TimeSlot
def convert_to_table(time_slot_list: list[TimeSlot]):
widths = [30, 26, 26]
r_str = f"+{'-'*(widths[0]+2)}+{'-'*(widths[1]+2)}+{'-'*(widths[2]+2)}+\n"
r_str += f"| {'Name':<30} | {'Startzeitpunkt':<26} | {'Endzeitpunkt':<26} |\n"
r_str += f"+{'-'*(widths[0]+2)}+{'-'*(widths[1]+2)}+{'-'*(widths[2]+2)}+\n"
for time_slot in time_slot_list:
r_str += f"| {time_slot.name:<30} | {str(time_slot.start):<26} | {str(time_slot.end):<26} |\n"
r_str += f"+{'-'*(widths[0]+2)}+{'-'*(widths[1]+2)}+{'-'*(widths[2]+2)}+"
return r_str