-
Notifications
You must be signed in to change notification settings - Fork 0
/
Person.py
67 lines (53 loc) · 1.93 KB
/
Person.py
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
""" contains all details on a person that are relevant and in database """
class Person:
def __init__(
self,
uid: str = None,
first_name: str = "",
middle_name: str = "",
last_name: str = "",
school_email: str = None,
personal_email: str = None,
preferred_email: bool = False,
active: bool = None,
emplid: str = None,
discord: str = None,
):
self.uid = None
self.first_name = first_name
self.middle_name = middle_name
self.last_name = last_name
self.school_email = school_email
self.personal_email = personal_email
self.preferred_email = preferred_email
self.active = active
self.discord = discord
self.emplid = emplid
def add_person(self):
from Database import Database
from Validation import Input
# color?
print(
"Input New User Information (* means manditory)\nOptional fields you can leave blank.\n^c to exit"
)
try:
full_name = Input("Full Name*: ", str).val.split(" ")
self.first_name = full_name[0]
if len(full_name) > 1:
self.last_name = full_name[-1]
middle_name = " ".join(full_name[1:-1])
self.middle_name = middle_name if middle_name != "" else None
self.school_email = Input("School Email*: ", str).val
self.personal_email = Input(
"Personal Email (assumed to be preferred): ", str, True
).val
if self.personal_email:
self.preferred_email = True
self.active = Input("Active BYTE member? (y/n)*: ", bool).val
self.discord = Input("Discord: ", str, True).val
self.emplid = Input("Emplid*: ", int).val
except KeyboardInterrupt:
exit(1)
d = Database()
d.add(self)
return