-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappointment.py
More file actions
71 lines (51 loc) · 2.1 KB
/
appointment.py
File metadata and controls
71 lines (51 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
class Appointment:
def __init__(self, day_of_week, start_time_hour):
self.__client_name = ''
self.__client_phone = ''
self.__appnt_type = 0
self.__day_of_week = day_of_week
self.__start_time_hour = start_time_hour
def get_client_name(self):
return self.__client_name
def get_client_phone(self):
return self.__client_phone
def get_appt_type(self):
return self.__appnt_type
def get_start_time_hour(self):
return self.__start_time_hour
def get_day_of_week(self):
return self.__day_of_week
def get_end_time_hour(self):
return self.get_end_time_hour + 1
def get_appt_type_desc(self):
apptype_description = {
0: "Available",
1: "Mens Cut",
2: "Ladies Cut",
3: "Mens Colouring",
4: "Ladies Colouring"
}
return apptype_description(self.__appnt_type, "Type")
def set_client_name(self, client_name):
self.__client_name = client_name
def set_appt_type(self, appt_type):
self.__appnt_type = appt_type
def schedule(self,client_name, client_phone, appt_type):
self.__client_name = client_name
self.__client_phone = client_phone
self.__appnt_type = appt_type
def cancel(self):
self.__client_name = ""
self.__client_phone = ""
self.__appnt_type = 0
def format_record(self):
return f'{self.__client_name}, {self.__client_phone}, {self.__appnt_type}, {self.__day_of_week}, {self.__start_time_hour}'
def __str__(self):
return f'{self.__client_name:<20}{self.__client_phone:<15}{self.__day_of_week:<10}{self.__start_time_hour:02}:00 - {self.get_end_time_hour}:00 {self.get_appt_type_desc()}'
def create_weekly_calendar(self):
calendar = []
days_of_the_week = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
for day in days_of_the_week:
for hour in range(9, 17):
calendar.append(Appointment(day, hour))
return calendar