Skip to content

Commit 8958a72

Browse files
committed
fix specials showing instead of normals
1 parent 745d590 commit 8958a72

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/find.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,20 @@ pub async fn find_move(char_id: usize, char_move: &str, db: Arc<Mutex<SqlConnect
7979
let db = db.lock().unwrap();
8080
add_regexp_function(&db).unwrap();
8181

82-
let mut alias_query = db.prepare("SELECT move_id FROM aliases WHERE move_id IN (SELECT id FROM moves WHERE character_id = :char_id) AND REPLACE(LOWER(alias), '.', '') REGEXP :move_regex ORDER BY id").unwrap();
8382
let mut input_query = db.prepare("SELECT id FROM moves WHERE character_id = :char_id AND REPLACE(LOWER(input), '.', '') REGEXP :move_regex ORDER BY id").unwrap();
83+
let mut alias_query = db.prepare("SELECT move_id FROM aliases WHERE move_id IN (SELECT id FROM moves WHERE character_id = :char_id) AND REPLACE(LOWER(alias), '.', '') REGEXP :move_regex ORDER BY id").unwrap();
8484
let mut name_query = db.prepare("SELECT id FROM moves WHERE character_id = :char_id AND REPLACE(LOWER(name), '.', '') REGEXP :move_regex ORDER BY id").unwrap();
8585

86-
// Checking if user input is alias
8786
// Semi join
8887
// https://media.datacamp.com/legacy/v1714587799/Marketing/Blog/Joining_Data_in_SQL_2.pdf
89-
if let Ok(move_id) = alias_query.query_row(
88+
// Checking if user input is move input
89+
if let Ok(move_id) = input_query.query_row(
9090
named_params! {":char_id": char_id, ":move_regex": move_regex},
9191
|row| row.get(0)
9292
) { return Ok((send_move(move_id, &db), move_id)) }
9393

94-
// Checking if user input is move input
95-
if let Ok(move_id) = input_query.query_row(
94+
// Checking if user input is alias
95+
if let Ok(move_id) = alias_query.query_row(
9696
named_params! {":char_id": char_id, ":move_regex": move_regex},
9797
|row| row.get(0)
9898
) { return Ok((send_move(move_id, &db), move_id)) }

0 commit comments

Comments
 (0)