Skip to content

Commit

Permalink
order by user
Browse files Browse the repository at this point in the history
  • Loading branch information
bryangerlach committed Sep 30, 2023
1 parent f399e4b commit 8654575
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/webs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ async fn hello(req: HttpRequest) -> impl Responder {
}
let mut conn = get_conn().await;

let devices = sqlx::query_as!(Device, "SELECT id, user, info, status FROM peer WHERE status > 0").fetch_all(&mut conn).await;
let devices = sqlx::query_as!(Device, "SELECT id, user, info, status FROM peer WHERE status > 0 ORDER BY user").fetch_all(&mut conn).await;
let row_count = devices.as_ref().unwrap().len();
let devices2 = sqlx::query_as!(Device, "SELECT id, user, info, status FROM peer WHERE status = 0").fetch_all(&mut conn).await;
let devices2 = sqlx::query_as!(Device, "SELECT id, user, info, status FROM peer WHERE status = 0 ORDER BY user").fetch_all(&mut conn).await;
let row_count2 = devices2.as_ref().unwrap().len();
let tot_rows = row_count + row_count2;

Expand Down

0 comments on commit 8654575

Please sign in to comment.