From c259ff6ea890aa671b6aee7080ce090da869785f Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 17 Feb 2025 21:30:44 +0100 Subject: Check max(id) is useless Remove condition on SQL query since we have only one position per user --- src/graphql/types/alert.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/graphql/types/alert.rs b/src/graphql/types/alert.rs index c38acf1..091d067 100644 --- a/src/graphql/types/alert.rs +++ b/src/graphql/types/alert.rs @@ -394,11 +394,7 @@ pub mod mutations { (SELECT area::geography FROM alerts WHERE id = $1), $2 ) - AND id = ( - SELECT MAX(id) - FROM positions - WHERE user_id = p.user_id - )", + ", &[&alert.id, &level.distance], ) .await? -- cgit v1.2.3-18-g5258