diff --git a/src/user.js b/src/user.js index fab0d12..9ff7638 100644 --- a/src/user.js +++ b/src/user.js @@ -138,7 +138,7 @@ export class User { check_distance($6::double precision, $7::double precision, (SELECT lat FROM cities WHERE ID = location), (SELECT lng FROM cities WHERE ID = location), range)` } AND (interest = $4 OR interest = 'b') - AND NOT (room_id = ANY(ARRAY(SELECT recipient FROM read_profiles))) + AND NOT EXISTS(SELECT sender, recipient FROM read_profiles WHERE sender = $2 AND recipient = room_id) ORDER BY RANDOM() LIMIT 1`, [myage, this.roomId, myinterest, mysex, myrange, lat, lng]) ).rows[0];