Skip to content

Commit a5d1fa4

Browse files
committed
Fixed match score again
1 parent 8925ab3 commit a5d1fa4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

backend/PyMatcha/utils/match_score.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import itertools
21
from typing import List
32
from typing import Optional
43

@@ -107,7 +106,11 @@ def _get_gender_query(orientation, gender):
107106
q4 = User.get_multis(orientation="homosexual", gender="male")
108107
q5 = User.get_multis(orientation="other", gender="male")
109108
q6 = User.get_multis(orientation="other", gender="female")
110-
return list(set(list(itertools.chain(q1, q2, q3, q4, q5, q6))))
109+
final = []
110+
for q in [q1, q2, q3, q4, q5, q6]:
111+
if q:
112+
final.extend(q)
113+
return list(set(final))
111114
elif orientation == "other":
112115
q1 = User.get_multis(orientation=orientation, gender="female")
113116
q3 = User.get_multis(orientation=orientation, gender="male")
@@ -121,6 +124,10 @@ def _get_gender_query(orientation, gender):
121124
if gender == "male":
122125
q4 = User.get_multis(orientation="homosexual", gender="male")
123126
q6 = User.get_multis(orientation="heterosexual", gender="female")
124-
return list(set(list(itertools.chain(q1, q2, q3, q4, q5, q6))))
127+
final = []
128+
for q in [q1, q2, q3, q4, q5, q6]:
129+
if q:
130+
final.extend(q)
131+
return list(set(final))
125132
else:
126133
raise ValueError("No match found for genre. This should not happen")

0 commit comments

Comments
 (0)