This commit is contained in:
leca 2024-08-17 13:16:59 +03:00
parent c64a1f1996
commit 01a74e5c5e
1 changed files with 1 additions and 1 deletions

View File

@ -125,6 +125,7 @@ export class User {
WHERE
age::numeric <@ ANY(ARRAY[numrange($1 - 2, $1 + 2)])
AND room_id != $2
AND NOT EXISTS(SELECT sender, recipient FROM read_profiles WHERE sender = $2 AND recipient = room_id)
AND ${myinterest !== 'b' ? "sex = $3" : "$3 = $3 AND $4 = $4 AND $5 = $5 AND $6 = $6 AND $7 = $7"}
AND ${myrange !== 0 ?
`location = ANY(ARRAY(SELECT ID
@ -138,7 +139,6 @@ 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 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];