Client Class soweit ready und period print bereinigt.
This commit is contained in:
parent
986e44d6c0
commit
0827ca9b9a
|
@ -37,7 +37,7 @@ for i in range(11, 42, 10):
|
|||
|
||||
class Client():
|
||||
months = ['Januar', 'Februar','März','April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember']
|
||||
|
||||
all_clients[]
|
||||
clients = 0
|
||||
def __init__(self, name: str, surname: str, client_num: int, room_num: int, period, key_num: int, bookings, status: bool):
|
||||
self.name = name
|
||||
|
@ -54,7 +54,7 @@ class Client():
|
|||
self.status = True
|
||||
Client.clients += 1
|
||||
|
||||
def change_room(self, surname, room_num = 0, key_num = 0):
|
||||
def change_room(self, surname, room_num = 0, key_num = 0): # Room add period
|
||||
self.room_num = room_num
|
||||
num_ = "key_" + str(key_num) + ".hand_out_key(" + str(key_num) + "," + "'" + str(surname) + "')"
|
||||
try:
|
||||
|
@ -70,11 +70,17 @@ class Client():
|
|||
# Length of stay as print
|
||||
def period_print(self):
|
||||
stay_period = []
|
||||
num_string = ""
|
||||
for i in self.period:
|
||||
if i.isdigit():
|
||||
stay_period.append(i)
|
||||
|
||||
if i.isnumeric():
|
||||
num_string += i
|
||||
if i == ",":
|
||||
stay_period.append(num_string)
|
||||
num_string = ""
|
||||
|
||||
stay_period.append(num_string)
|
||||
|
||||
print(stay_period)
|
||||
stay_period = tuple(stay_period)
|
||||
# Same month
|
||||
if stay_period[1] == stay_period[3]:
|
||||
|
@ -85,7 +91,14 @@ class Client():
|
|||
print("Vom", stay_period[0], "bis", stay_period[2], month_print)
|
||||
# Across months
|
||||
if stay_period[1] != stay_period[3]:
|
||||
days = 28 - int(stay_period[0]) + int(stay_period[2])
|
||||
# Stay period more than 1 month
|
||||
if int(stay_period[3]) - int(stay_period[1]) > 1:
|
||||
days = 28 - int(stay_period[0]) + int(stay_period[2]) + \
|
||||
((int(stay_period[3]) - int(stay_period[1])-1) * 28)
|
||||
# Stay period
|
||||
else:
|
||||
days = 28 - int(stay_period[0]) + int(stay_period[2])
|
||||
|
||||
month_num_1 = int(stay_period[1]) - 1
|
||||
month_num_2 = int(stay_period[3]) - 1
|
||||
month_print_1 = Client.months[month_num_1]
|
||||
|
@ -122,4 +135,5 @@ class Client():
|
|||
|
||||
|
||||
|
||||
w43 = Client("David", "Gebert", "w43", 0, "11,2,5,3", 22, (51,61,77), False)
|
||||
w43 = Client("David", "Gebert", "w43", 0, "01,02,03,03", 22, (51,61,77), False)
|
||||
w43.period_print()
|
||||
|
|
Loading…
Reference in New Issue