Skip to content

Commit

Permalink
Get Stats by Name instead of ID, sort by difficult
Browse files Browse the repository at this point in the history
  • Loading branch information
OctaneAL committed Aug 12, 2024
1 parent d97bd9c commit 9e9d1b7
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 100 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE difficulty
DROP COLUMN int_difficulty;
2 changes: 2 additions & 0 deletions migrations/2024-08-10-164427_add_difficulty_int_column/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE difficulty
ADD COLUMN int_difficulty integer;
2 changes: 1 addition & 1 deletion src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async fn get_difficulties(
) -> impl Responder {
let client = pool.lock().await;

let difficulties_query = "SELECT id, name FROM difficulty ORDER by name;";
let difficulties_query = "SELECT id, name FROM difficulty ORDER by int_difficulty;";
let difficulties = client
.query(difficulties_query, &[])
.await
Expand Down
1 change: 1 addition & 0 deletions src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ diesel::table! {
difficulty (id) {
id -> Int4,
name -> Varchar,
int_difficulty -> Nullable<Int4>,
}
}

Expand Down
Loading

0 comments on commit 9e9d1b7

Please sign in to comment.