-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
411 lines (354 loc) · 15.8 KB
/
main.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# import pytest
from important_links import important_links_groups, guest_controls, update_guest_controls, account_language, \
update_account_language
from profile_creation import *
from search_students import *
from pending_requests import *
from show_network import *
from useful_links import useful_links_groups
from account_creation import create_account, is_secure
from job_creation import create_job
from job_deletion import *
from job_apply import apply_job
from account_login import passwd_valid, login_screen
from csv_read_write import get_accounts_from_csv, get_jobs_from_csv
from send_message import send_message_ui
from view_message import at_least_1_new_message, view_messages_ui
from notifications import *
from csv_read_write import get_jobs_from_csv
from job_apply import count_applied_job
from learning import learning_ui
from input_accounts import input_accounts
from input_jobs import input_jobs
from input_training import input_training
from output_api import *
# Function for the HomeScreen
def home_screen():
# "Homepage" Menu
menu = {"1": "Welcome Video",
"2": "Login/Register"}
print("\t***************************\n\t Welcome to InCollege!\n\t***************************\n")
print("\t ** Success Story! **\n")
print("\t Daniela, USF 21':\n \"InCollege has made my stressful job search a\n thousands times",
"easier by connecting with other\n students and applying to jobs in one go!\"\n")
while True:
# prints menu options
options = menu.keys()
for x in options:
print("\t", x, ")", menu[x])
selection = input("\t Choose an option:")
if selection == '1':
print("\nVideo is now Playing.\n")
input("Press Enter to exit\n")
elif selection == '2':
break
else:
print("Unknown Selection, Try Again!")
# function to pull up main screen
def main_screen(accounts, jobs=None):
print("\nWELCOME TO InCollege!")
main_screen_opt = {"1": "Create a new account",
"2": "Login to existing account",
"3": "Connect with friends",
"4": "InCollege Useful Links",
"5": "InCollege Important Links",
"6": "Training",
"q": "Quit InCollege"}
menu_training = {"1": "Training and Education",
"2": "IT Help Desk",
"3": "Business Analysis and Strategy",
"4": "Security",
"q": "Quit"}
menu_training = input_training(menu_training)
menu_train_education = {"1": "Workshops",
"2": "Articles",
"3": "Profile Optimization",
"4": "Connecting",
"q": "Quit"}
menu_trending_courses = {"1": "How to use In College learning",
"2": "Train the trainer",
"3": "Gamification of learning",
"q": "Quit"}
# accepts user input and will bring them to the appropriate screen
logged_in_user = None
main_condition = True
while main_condition:
# following code handles the user input for the main screen
options = main_screen_opt.keys()
for x in options:
print(x, ")", main_screen_opt[x])
selection = input("Select an Option: ")
if selection == '1':
main_condition = False
create_account(accounts)
logged_in_user = login_screen(accounts)
elif selection == '2':
main_condition = False
logged_in_user = login_screen(accounts)
elif selection == '3':
# if the user is able to connect with an existing account, they are given the option to login or sign up
if connect_with_users(accounts):
print("\nWould you like to login or sign up to join your friend?")
connected_condition = True
while connected_condition:
connected_selection = input("(Enter 'l' to login, 's' for sign up or 'q' to go back): ")
if connected_selection == 'l': # user selected login
connected_condition = False
logged_in_user = login_screen(accounts)
main_condition = not logged_in_user
elif connected_selection == 's': # user selected sign up
connected_condition = False
create_account(accounts)
logged_in_user = login_screen(accounts)
main_condition = not logged_in_user
elif connected_selection == 'q': # user selected go back
connected_condition = False
else:
print("\nUnknown Selection, Try Again!\n")
elif selection == '4':
# if the user selected signup from the useful links general group
# go to the create account screen
signup_selected = useful_links_groups()
if signup_selected:
main_condition = False
create_account(accounts)
logged_in_user = login_screen(accounts)
elif selection == '5':
important_links_groups(False)
elif selection == '6':
while True:
print("\n********* Training Options *********\n")
# pulls up menu for Training
options = menu_training.keys()
for x in options:
print(x, ")", menu_training[x])
selection = input("Select an option: ")
if selection == '1':
while True:
print("\n********* Training and Education Options *********\n")
# pulls up menu for Training and Education
options = menu_train_education.keys()
for x in options:
print(x, ")", menu_train_education[x])
selection = input("Select an option: ")
if selection == '1':
print("Under Construction")
elif selection == '2':
print("Under Construction")
elif selection == '3':
print("Under Construction")
elif selection == '4':
print("Under Construction")
elif selection == 'q':
break
else:
print("\nUnknown Selection, Try Again!\n")
elif selection == '2':
print("Coming Soon!")
elif selection == '3':
while True:
print("\n* Not seeing what you're looking for? Sign in to see all 7,609 results\n")
print("\n********* Trending Courses *********\n")
# pulls up menu for Trending Courses
options = menu_trending_courses.keys()
for x in options:
print(x, ")", menu_trending_courses[x])
selection = input("Select an option: ")
if selection == '1':
main_condition = False
logged_in_user = login_screen(accounts)
elif selection == '2':
main_condition = False
logged_in_user = login_screen(accounts)
elif selection == '3':
main_condition = False
logged_in_user = login_screen(accounts)
elif selection == 'q':
break
else:
print("\nUnknown Selection, Try Again!\n")
elif selection == '4':
print("Coming Soon!")
elif selection == 'q':
break
else:
print("\nUnknown Selection, Try Again!\n")
elif selection == 'q':
main_condition = False
print("\nHave a nice day!")
else:
print("\nUnknown Selection, Try Again!\n")
if logged_in_user is not None:
options_screen(logged_in_user, accounts, jobs)
# Function to pull up the options menu
# The user argument is the Account object for the user that is logged in
# The accounts argument is the accounts list
# The jobs argument is the jobs list
def options_screen(user, accounts, jobs):
# Determines if the logged in user has any pending friend requests and notifies them if so
# requests = at_least_1_pending(user)
# if requests > 0:
# print("\n*** YOU HAVE PENDING FRIEND REQUESTS! CHOOSE OPTION 9 FOR MORE INFO! ***")
# determine if the logged in user has any new messages and notifies them if so
num_messages = at_least_1_new_message(user)
if num_messages > 0:
print("\n*** YOU HAVE NEW MESSAGES! CHOOSE OPTION 11 FOR MORE INFO! ***")
# show notifications on login
login_notifications = get_login_notifications(user)
print("\n ********* Notifications(", len(login_notifications), ") ********* \n", sep="")
for notification in login_notifications:
print(" *", notification)
menu_opt = {"1": "Job Search/Internship",
"2": "Find Someone you know",
"3": "Learn a new skill",
"4": "InCollege Useful Links",
"5": "InCollege Important Links",
"6": "Create Profile",
"7": "View Profile",
"8": "Search Students",
"9": "Pending Friend Requests",
"10": "Show My Network",
"11": "Messaging",
"12": "InCollege Learning",
"q": "Logout and Quit InCollege"}
menu_skills = {"1": "Communication",
"2": "Software",
"3": "Marketing",
"4": "Project Management",
"5": "Design",
"q": "Quit"}
menu_jobs = {"1": "Post a Job",
"2": "View Job Listings",
"3": "Delete a Job You Posted",
"q": "Quit"}
menu_messaging = {"1": "Send a Message",
"2": "View Messages",
"q": "Quit"}
while True:
print("\n ********* InCollege Options ********* \n")
options = menu_opt.keys()
for x in options:
print(x, ")", menu_opt[x])
selection = input("Select an Option: ")
if selection == '1':
# Pulls up the menu with options for jobs
while True:
# Determines how many jobs the user has applied for and notifies them if so
if count_applied_job(user) > 0:
applied_count = count_applied_job(user)
print("\n*** You have applied for ", applied_count, "job(s). ***")
print("\n ********* Job Options ********* \n")
options = menu_jobs.keys()
for x in options:
print(x, ")", menu_jobs[x])
selection = input("Select an Option: ")
if selection == '1':
create_job(user, jobs)
elif selection == '2':
apply_job(user, jobs)
elif selection == '3':
delete_job(user, jobs)
elif selection == 'q':
break
else:
print("Unknown selection! Try Again!")
elif selection == '2':
print("\nUnder Construction\n")
elif selection == '3':
while True:
print("\n ********* Learn a Skill! ********* \n")
skills = menu_skills.keys()
for x in skills:
print(x, ")", menu_skills[x])
selection = input("Select a skill: ")
if selection == '1':
print("\nUnder Construction\n")
elif selection == '2':
print("\nUnder Construction\n")
elif selection == '3':
print("\nUnder Construction\n")
elif selection == '4':
print("\nUnder Construction\n")
elif selection == '5':
print("\nUnder Construction\n")
elif selection == 'q':
break
else:
print("Unknown Selection, Try Again!")
elif selection == '4':
while useful_links_groups():
print("\nYou are already signed in, please sign out to create a new account")
elif selection == '5':
important_links_groups(user, accounts)
print("return to main options links")
for account in accounts:
print(account.get_account_details())
elif selection == '6':
profile_creation(user)
elif selection == '7':
view_profile()
elif selection == '8':
search_students(user, accounts)
elif selection == '9':
pending_requests(user, accounts)
elif selection == '10':
show_network(user)
elif selection == '11':
while True:
# print messaging menu
print("\n ********* Messaging Options ********* \n")
options = menu_messaging.keys()
for x in options:
print(x, ")", menu_messaging[x])
messaging_selection = input("Select an Option: ")
if messaging_selection == '1':
send_message_ui(user, accounts)
elif messaging_selection == '2':
view_messages_ui(user, accounts)
elif messaging_selection == 'q':
break
else:
print("Unknown Selection, Try Again!")
elif selection == '12':
learning_ui(user)
elif selection == 'q':
print("\nHave a nice day!")
break
else:
print("Unknown Selection, Try Again!")
# Function to connect with other users
def connect_with_users(accounts):
# following code gets the first and last name of the user to search for
print("\n ********* Connect with other InCollege users ********* \n")
firstname_ = input("Enter the person's first name: ")
lastname_ = input("Enter the person's last name: ")
if user_exists(accounts, firstname_, lastname_):
print("\nThey are a part of the InCollege system!")
return True
else:
print("\nThey are not yet part of the InCollege system!")
return False
# function looks to see if there is an account with the a matching first and last name
def user_exists(accounts, firstname, lastname):
# loop through the accounts
for account in accounts:
if account.firstname == firstname and account.lastname == lastname:
return True
return False
# PROGRAM START #
accounts_list = [] # global variable that holds all of the account objects
jobs_list = [] # global variable that holds all of the job objects
if __name__ == '__main__':
accounts_list = get_accounts_from_csv()
accounts_list = input_accounts(accounts_list)
jobs_list = get_jobs_from_csv()
job_list = input_jobs(jobs_list)
# Output API calls
output_api_jobs()
output_api_profile()
output_api_user()
output_api_training()
output_api_applied_jobs()
output_api_saved_jobs()
home_screen()
main_screen(accounts_list, jobs_list)