-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatch.py
More file actions
77 lines (60 loc) · 2.35 KB
/
Copy pathMatch.py
File metadata and controls
77 lines (60 loc) · 2.35 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
72
73
74
75
76
77
"""
Final Project in CSIT335
Group 18 Members: Lhora Mae Alvarez, Mel Jay Llanos, and Jecee Ryn Obrero
Findrr - Online Dating Application
Findrr is a simple online dating app where users find the romance of their life.
Users can like or dislike the profiles of other users.
Findrr also employs a "double opt-in" mechanism, in which both users must match in order to send messages.
"""
from Profile import Profile
class Match():
profile1: Profile # main user
profile2: Profile # secondary user
isLike: bool = False
def __init__(
self,
profile1: Profile,
profile2: Profile,
isLike: bool = False
) -> None:
self.profile1 = profile1
self.profile2 = profile2
self.isLike = isLike
def _isMatch(self):
return self.addToMatchList()
def checkValidAccounts(self):
return self.profile1.isValid and self.profile2.isValid
def checkPremium(self):
return self.profile1.isPremium and self.checkValidAccounts()
# check if other users like the main user
def isLikedProfile(self):
return self.profile1.id in self.profile2.likeList and self.checkValidAccounts()
# check if main user likes the other user
def isLikeProfile(self):
return self.isLike and self.checkValidAccounts()
def addToLikeList(self):
if self.checkValidAccounts() and self.isLike and self.checkValidAccounts():
self.profile1.addToLikeList(self.profile2.id)
return True
return False
def addToMatchList(self):
if self.isLikedProfile() and self.isLikeProfile() and self.checkValidAccounts():
self.profile1.addToMatchList(self.profile2.id)
self.profile2.addToMatchList(self.profile1.id)
return True
return False
def addToRewindList(self):
if not self.isLikeProfile() and self.checkValidAccounts():
self.profile1.addToRewindList(self.profile2.id)
return True
return False
def notifyMatch(self):
if self._isMatch() and self.checkValidAccounts():
print("It's a Match")
return True
return False
def allowConnection(self):
if (self._isMatch() or (self.profile1.isPremium and self.isLike)) and self.checkValidAccounts():
print("You can message now.")
return True
return False