Skip to content

Commit 8925ab3

Browse files
committed
Fixed recommendations test
1 parent b7d617b commit 8925ab3

File tree

3 files changed

+62
-32
lines changed

3 files changed

+62
-32
lines changed

PyMatcha.postman_collection.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4821,7 +4821,7 @@
48214821
" pm.response.to.have.status(200);",
48224822
"});",
48234823
"",
4824-
"tests[\"Message is correct\"] = response.message == \"No new messages.\""
4824+
"tests[\"No new messages\"] = response.new_messages.length == 0"
48254825
],
48264826
"type": "text/javascript"
48274827
}
@@ -5856,92 +5856,92 @@
58565856
],
58575857
"variable": [
58585858
{
5859-
"id": "025546f0-eca9-4027-9e80-9e00e9b3934b",
5859+
"id": "3b1c4a05-afc9-4d76-92f8-a1eead538b43",
58605860
"key": "host",
58615861
"value": "http://127.0.0.1:5000"
58625862
},
58635863
{
5864-
"id": "71062daa-fc02-4715-b403-cb81e94d1a0d",
5864+
"id": "0f7fc70d-5f57-4d34-b25e-ec9a643d6af6",
58655865
"key": "user_id",
58665866
"value": ""
58675867
},
58685868
{
5869-
"id": "78034f4e-24bd-4b2f-b023-3a6c2bb840a2",
5869+
"id": "6b79a53d-16ca-4170-ad83-e2843c6b61ed",
58705870
"key": "user_email",
58715871
"value": "foo@example.org"
58725872
},
58735873
{
5874-
"id": "5347bca2-fb5c-4410-8952-e10b3128688f",
5874+
"id": "5cc4b3de-ea74-49db-a6b5-c729f923ca5b",
58755875
"key": "user_username",
58765876
"value": "foo"
58775877
},
58785878
{
5879-
"id": "66a682e9-8a4e-4de2-89ea-7ee3cb6034d2",
5879+
"id": "08841b46-3845-454e-96ce-838996790ab6",
58805880
"key": "user_password",
58815881
"value": "admin"
58825882
},
58835883
{
5884-
"id": "a8ec63d8-a98d-457b-ae99-c1a3227d808c",
5884+
"id": "dbe5daf6-9aa1-42ff-bd6b-e09ab2dccbf0",
58855885
"key": "user_firstname",
58865886
"value": "Foo"
58875887
},
58885888
{
5889-
"id": "60841476-911e-4ae3-bbf5-dbde01d74a74",
5889+
"id": "10b3e4e0-1da8-40b7-b4fe-e5f60617bb78",
58905890
"key": "user_lastname",
58915891
"value": "Bar"
58925892
},
58935893
{
5894-
"id": "79acb0bc-e9c9-44e3-999a-fe823db81787",
5894+
"id": "e29281ab-3bd4-4608-8b90-ee5658b81bbe",
58955895
"key": "debug_token",
58965896
"value": "xX69jules69Xx"
58975897
},
58985898
{
5899-
"id": "a44c9c10-a19a-4f46-8c33-b4bf3b3ad058",
5899+
"id": "f3296656-44a1-4108-a326-57ee1d7b7da5",
59005900
"key": "user_access_token",
59015901
"value": ""
59025902
},
59035903
{
5904-
"id": "05b47e79-daca-4a40-9f58-d8d1d891af1a",
5904+
"id": "b06ae0b3-5690-42da-a641-93f81329a487",
59055905
"key": "user_refresh_token",
59065906
"value": ""
59075907
},
59085908
{
5909-
"id": "ff897225-fbcf-4f81-b869-ed3b2bed3f44",
5909+
"id": "a72e4b18-16c0-4126-a6b3-e13d493369a6",
59105910
"key": "expired_token",
59115911
"value": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1OTAyNDIyNjQsIm5iZiI6MTU5MDI0MjI2NCwianRpIjoiNTM0ZGI5NzQtOWE4Ni00MGViLWE1NDEtMDg3N2ZmNzQ3NDVhIiwiZXhwIjoxNTkwMjQyMzI0LCJpZGVudGl0eSI6eyJpZCI6NTEyLCJlbWFpbCI6ImZvb0BleGFtcGxlLm9yZyIsInVzZXJuYW1lIjoiYmFyIiwiaXNfb25saW5lIjp0cnVlLCJkYXRlX2xhc3RzZWVuIjoiU2F0LCAyMyBNYXkgMjAyMCAxMzo1Nzo0NCBHTVQifSwiZnJlc2giOnRydWUsInR5cGUiOiJhY2Nlc3MifQ.NTp2P0WNkXDwzuzrcNIQdeAfizQ57HQgkzBLSvY1yHU"
59125912
},
59135913
{
5914-
"id": "4baa9b95-1e9b-4cce-830e-433dff673c4a",
5914+
"id": "d062d4f6-53e1-4a15-a66b-a138edf786ef",
59155915
"key": "user_orientation",
59165916
"value": "heterosexual"
59175917
},
59185918
{
5919-
"id": "cfa43a74-4cb2-4082-b68b-e4d62c6bf8fb",
5919+
"id": "d4cf3d62-6dff-4da5-843b-4c124e4c122a",
59205920
"key": "user_bio",
59215921
"value": "Lorem Ipsum is the single greatest threat. We are not - we are not keeping up with other websites. Lorem Ipsum best not make any more threats to your website. It will be met with fire and fury like the world has never seen. Does everybody know that pig named Lorem Ipsum? An ‘extremely credible source’ has called my office and told me that Barack Obama’s placeholder text is a fraud."
59225922
},
59235923
{
5924-
"id": "f691eeab-c7b5-4ea9-a6d6-e801eb7b5f94",
5924+
"id": "e51923fb-9335-459b-97ea-2dee4f464a8a",
59255925
"key": "user_gender",
59265926
"value": "male"
59275927
},
59285928
{
5929-
"id": "a2bf07cc-7ceb-4081-8e62-f08c28a2ae2f",
5929+
"id": "d6eccdcb-6a27-499e-a8ac-1474ad749b5e",
59305930
"key": "user_birthdate",
59315931
"value": "06/04/1998"
59325932
},
59335933
{
5934-
"id": "289ce5eb-84d9-45f6-9f1d-09759cbaadb9",
5934+
"id": "142a5845-34bb-48bc-8895-30d467a99a6b",
59355935
"key": "user_lat",
59365936
"value": "44.8404"
59375937
},
59385938
{
5939-
"id": "c6c62664-fb01-4311-8967-403398a48942",
5939+
"id": "9584624a-8a2e-4e4d-9833-42edcbad4625",
59405940
"key": "user_lng",
59415941
"value": "-0.5805"
59425942
},
59435943
{
5944-
"id": "8204866c-6201-426d-95d5-f1aed0011d57",
5944+
"id": "09eab2dc-f84b-4982-b474-4465b7f87bb5",
59455945
"key": "user_ip",
59465946
"value": "77.205.46.181"
59475947
}

backend/PyMatcha/routes/api/debug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,6 @@ def debug_send_message():
177177
@debug_token_required
178178
def debug_recommendations_start_process():
179179
"""This function will create 100 random users and calculate recommendations"""
180-
populate_users(amount=10, drop_user_table=False)
180+
populate_users(amount=30, drop_user_table=False)
181181
update_user_recommendations()
182182
return Success("Done")

backend/PyMatcha/utils/match_score.py

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,34 +38,64 @@ def _get_gender_query(orientation, gender):
3838
if gender == "female":
3939
q1 = User.get_multis(orientation=orientation, gender="male")
4040
q2 = User.get_multis(orientation="other", gender="male")
41-
q1.extend(q2)
42-
return q1
41+
if q1 and q2:
42+
q1.extend(q2)
43+
return q1
44+
if q1 and not q2:
45+
return q1
46+
if q2 and not q1:
47+
return q2
4348
elif gender == "male":
4449
q1 = User.get_multis(orientation=orientation, gender="female")
4550
q2 = User.get_multis(orientation="other", gender="female")
46-
q1.extend(q2)
47-
return q1
51+
if q1 and q2:
52+
q1.extend(q2)
53+
return q1
54+
if q1 and not q2:
55+
return q1
56+
if q2 and not q1:
57+
return q2
4858
else:
4959
q1 = User.get_multis(orientation=orientation, gender="female")
5060
q2 = User.get_multis(orientation=orientation, gender="male")
51-
q1.extend(q2)
52-
return q1
61+
if q1 and q2:
62+
q1.extend(q2)
63+
return q1
64+
if q1 and not q2:
65+
return q1
66+
if q2 and not q1:
67+
return q2
5368
elif orientation == "homosexual":
5469
if gender == "female":
5570
q1 = User.get_multis(orientation=orientation, gender="female")
5671
q2 = User.get_multis(orientation="other", gender="female")
57-
q1.extend(q2)
58-
return q1
72+
if q1 and q2:
73+
q1.extend(q2)
74+
return q1
75+
if q1 and not q2:
76+
return q1
77+
if q2 and not q1:
78+
return q2
5979
elif gender == "male":
6080
q1 = User.get_multis(orientation=orientation, gender="male")
6181
q2 = User.get_multis(orientation="other", gender="male")
62-
q1.extend(q2)
63-
return q1
82+
if q1 and q2:
83+
q1.extend(q2)
84+
return q1
85+
if q1 and not q2:
86+
return q1
87+
if q2 and not q1:
88+
return q2
6489
else:
6590
q1 = User.get_multis(orientation=orientation, gender="female")
6691
q2 = User.get_multis(orientation=orientation, gender="male")
67-
q1.extend(q2)
68-
return q1
92+
if q1 and q2:
93+
q1.extend(q2)
94+
return q1
95+
if q1 and not q2:
96+
return q1
97+
if q2 and not q1:
98+
return q2
6999
elif orientation == "bisexual":
70100
q1 = User.get_multis(orientation=orientation, gender="female")
71101
q3 = User.get_multis(orientation=orientation, gender="male")

0 commit comments

Comments
 (0)