-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
63 lines (57 loc) · 2.09 KB
/
Copy pathapp.py
File metadata and controls
63 lines (57 loc) · 2.09 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
from services.supabase_db import check_if_user_exists, fetch_user_ratings
from gui.resume_rater import start_rater
from gui.view_ratings import start_viewer
from gui.job_matcher import start_matcher
def handle_menu(username, is_new_user=False):
while True:
print("\n" + "=" * 40)
if is_new_user:
print(f'Hi {username}, welcome to PyRater!')
print("1. Start Resume Rater")
print("2. Start Job Matcher")
print("3. Exit")
else:
print(f"Hi {username}, welcome back to PyRater!")
print("1. Start Resume Rater")
print("2. Start Job Matcher")
print("3. View Ratings History")
print("4. Exit")
option = input("Enter an option: ").strip()
if not option.isdigit():
print("\n Invalid input. Please enter a number.")
continue
option = int(option)
if is_new_user:
match option:
case 1:
start_rater(username)
break
case 2:
start_matcher(username)
break
case 3:
print("Thanks for using PyRater, bye!")
break
case _:
print("Invalid option. Please try again.")
else:
match option:
case 1:
start_rater(username)
break
case 2:
start_matcher(username)
break
case 3:
ratings = fetch_user_ratings(username.lower())
start_viewer(username, ratings)
break
case 4:
print("Thanks for using PyRater, bye!")
break
case _:
print("Invalid option. Please try again.")
if __name__ == "__main__":
username = input("Enter your username: ").strip()
user_exists = check_if_user_exists(username.lower())
handle_menu(username, is_new_user=not user_exists)