-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprofile.py
201 lines (167 loc) · 7.88 KB
/
profile.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
import prev_page as pv
import database as db
import pages as pg
#--------------------ABOUT SESSION-------------------
def aboutProfilePage(uName):
if pg.pagesVisited[-1] != "aboutProfile":
pg.pagesVisited.append("aboutProfile")
tmpcon = db.sqlite3.connect('inCollege.db')
tmpcursor = tmpcon.cursor()
tmpcursor.execute("SELECT * FROM about WHERE username = ?", (uName,))
p_about = tmpcursor.fetchone()
print("\nlast saved: ")
print(p_about)
print("\nIn the ABOUT page you will be creating a title, Selecting your major, "
"university and writing a description\n")
if p_about == None:
tmpcursor.execute("INSERT INTO about VALUES (?, ?, ?, ?, ?)",
(uName,
input("\nTitle of your profile: "), input("\nWhat is your Major: ").title(), input("\nWhat is your university: ").title(),
input ("\nWrite a discription for your profile: ")))
else:
tmpcursor.execute("UPDATE about SET title = ?, major = ? , university = ?, description = ? where username = ?",
(input("\nTitle of your profile: "), input("\nWhat is your Major: ").title(), input("\nWhat is your university: ").title(),
input ("\nWrite a discription for your profile"),uName))
tmpcon.commit()
tmpcursor.execute("SELECT * FROM about WHERE username = ?", (uName,))
p_about = tmpcursor.fetchone()
tmpcon.close()
print("\nsuccessfully saved: ")
print(p_about)
pv.previous()
#----------------------experience session----------------
def experiencePage(uName):
if pg.pagesVisited[-1] != "experience":
pg.pagesVisited.append("experience")
tmpcon = db.sqlite3.connect('inCollege.db')
tmpcursor = tmpcon.cursor()
tmpcursor.execute("SELECT * FROM experience WHERE username = ?", (uName,))
exp = tmpcursor.fetchall()
print("\nlast saved: ")
print(exp)
print("\nIn the Experience page you will be creating a job title, "
"employer, Date started, date ended, location, and job description \n")
if len(exp) < 3:
tmpcursor.execute("INSERT INTO experience VALUES (?, ?, ?, ?, ?, ?, ? )",
(uName,
input("\nTitle of the JOB : "), input("\nWho is/was the employer: "), input("\nDate Started: "),
input("\nDate ended: "),
input("\nLocation: "),
input ("\nDescribe Your responsibilities: ")))
else:
print ("\nJob History Full (up to 3 jobs)")
tmpcon.commit()
tmpcursor.execute("SELECT * FROM experience WHERE username = ?", (uName,))
exp = tmpcursor.fetchall()
tmpcon.close()
print("\nsuccessfully saved: ")
print(len(exp))
pv.previous()
#--------------------EDUCATION SESSION-------------------
def educationPage(uName):
if pg.pagesVisited[-1] != "education":
pg.pagesVisited.append("education")
tmpcon = db.sqlite3.connect('inCollege.db')
tmpcursor = tmpcon.cursor()
tmpcursor.execute("SELECT * FROM education WHERE username = ?", (uName,))
edu = tmpcursor.fetchone()
print("\nlast saved: ")
print(edu)
print("\nIn the EDUCATION SECTION you will be updating your school , degree and years \n")
# (username, school , date_start, degree , years)'''
if edu == None:
tmpcursor.execute("INSERT INTO education VALUES (?, ?, ?, ?)",
(uName,
input("\nName of the School: ").title(), input("\nHighest Degree: "), input("\nYears Attended: ")))
else:
tmpcursor.execute("UPDATE education SET school = ?, degree = ? , years = ? where username = ?", (input("\nName of the School: ").title(), input("\nHighest Degree: "), input("\nYears Attended: "),
uName))
tmpcon.commit()
tmpcursor.execute("SELECT * FROM education WHERE username = ?", (uName,))
edu = tmpcursor.fetchone()
tmpcon.close()
print("\nsuccessfully saved: ")
print(edu)
pv.previous()
#-------------------------view profile--------------
def viewProfilePage(uName, view = None):
if pg.pagesVisited[-1] != "view-profile":
pg.pagesVisited.append("view-profile")
tmpcon = db.sqlite3.connect('inCollege.db')
tmpcursor = tmpcon.cursor()
tmpcursor.execute("SELECT * FROM about WHERE username = ?", (uName,))
about = tmpcursor.fetchone()
if view == True and about == None:
print("User did not complete their profile.")
return
elif about == None:
print ("\n YOU have Not yet completed the About section of your profile. Please review your ABOUT Section")
else:
print("\nPROFILE BY {}: "
"\n--------------ABOUT SECTION-------- ->"
"\nProfile Title: {}" "\nMajor: {}"
"\nUniversity: {}"
"\nAbout: {} \n".format(about[0], about[1], about[2], about[3], about[4]))
tmpcursor.execute("SELECT * FROM experience WHERE username = ?", (uName,))
exp = tmpcursor.fetchall()
row_exp = len(exp)
print(row_exp)
if row_exp == None:
print ("\n YOU have Not yet completed the EXPERIENCE section of your profile. "
"Please review your EXPERIENCE Section")
elif row_exp == 1 :
print("--------------EXPERIENCE SECTION--------->"
"\nJOB 1 Title : {}"
"\nWho is/was the employer: {}"
"\nDate Started: {}"
"\nDate ended: {}"
"\nLocation: {}"
"\nResponsibilities: {}".format(exp[0][1], exp[0][2], exp[0][3], exp[0][4], exp[0][5],exp[0][6]))
elif row_exp == 2 :
print("--------------EXPERIENCE SECTION--------->"
"\nJOB 1 Title : {}"
"\nWho is/was the employer: {}"
"\nDate Started: {}"
"\nDate ended: {}"
"\nLocation: {}"
"\nResponsibilities: {}".format(exp[0][1], exp[0][2], exp[0][3], exp[0][4], exp[0][5],exp[0][6]))
print(
"\nJOB 2 Title : {}"
"\nWho is/was the employer: {}"
"\nDate Started: {}"
"\nDate ended: {}"
"\nLocation: {}"
"\nResponsibilities: {}".format(exp[1][1], exp[1][2], exp[1][3], exp[1][4], exp[1][5],exp[1][6]))
elif row_exp == 3:
print("--------------EXPERIENCE SECTION--------->"
"\nJOB 1 Title : {}"
"\nWho is/was the employer: {}"
"\nDate Started: {}"
"\nDate ended: {}"
"\nLocation: {}"
"\nResponsibilities: {}".format(exp[0][1], exp[0][2], exp[0][3], exp[0][4], exp[0][5],exp[0][6]))
print(
"\nJOB 2 Title : {}"
"\nWho is/was the employer: {}"
"\nDate Started: {}"
"\nDate ended: {}"
"\nLocation: {}"
"\nResponsibilities: {}".format(exp[1][1], exp[1][2], exp[1][3], exp[1][4], exp[1][5],exp[1][6]))
print(
"\nJOB 3 Title : {}"
"\nWho is/was the employer: {}"
"\nDate Started: {}"
"\nDate ended: {}"
"\nLocation: {}"
"\nResponsibilities: {}".format(exp[2][1], exp[2][2], exp[2][3], exp[2][4], exp[2][5],exp[2][6]))
tmpcursor.execute("SELECT * FROM education WHERE username = ?", (uName,))
edu = tmpcursor.fetchone()
if edu == None:
print ("\n YOU have Not yet completed the About section of your profile. Please review your ABOUT Section")
else:
print(
"\n--------------EDUCATION SECTION-------- ->"
"\nProfile Title: {}" "\nMajor: {}"
"\nUniversity: {}"
"\nAbout: {} \n".format(edu[0], edu[1], edu[2], edu[3]))
pv.previous()