Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,10 +950,12 @@ def next_profile():
opposite_genders = ["male", "female", "non-binary", "prefer-not-to-say"] # fallback

# Get already viewed profiles
viewed_res = supabase.table("viewed_profiles") \
.select("viewed_id") \
.eq("user_id", current_user_id) \
viewed_res = (
supabase.table("viewed_profiles")
.select("viewed_id")
.eq("user_id", current_user_id)
.execute()
)
viewed_ids = [row["viewed_id"] for row in viewed_res.data]

# Fetch potential matches (excluding viewed)
Expand All @@ -962,8 +964,7 @@ def next_profile():
.select("id, name, age, bio, photos")
.in_("gender", opposite_genders)
.neq("id", current_user_id)
.not_.in_("id", viewed_ids)
# ✅ exclude already viewed
.not_.in_("id", viewed_ids) # ✅ exclude already viewed
.execute()
)

Expand All @@ -986,7 +987,7 @@ def next_profile():
"created_at": now
}).execute()

# Log in match_history (if unique)
# Log in match_history (if unique, like 1st version)
existing_match = (
supabase.table("match_history")
.select("id")
Expand All @@ -1002,7 +1003,7 @@ def next_profile():
"created_at": now
}).execute()

# Always log in match_activity
# Always log in match_activity (like 1st version)
supabase.table("match_activity").insert({
"user_id": current_user_id,
"matched_id": matched_profile['id'],
Expand Down Expand Up @@ -1105,3 +1106,4 @@ def logout():