Commit 1ddf05ad authored by Robert Czechowski's avatar Robert Czechowski

Admin interface: Make name search case insensitive in postgres, make oauth id...

Admin interface: Make name search case insensitive in postgres, make oauth id search also look for oauth id without school id
parent 4796f436
Pipeline #871 passed with stages
in 25 minutes and 34 seconds
......@@ -1423,13 +1423,14 @@ impl MedalConnection for Connection {
let query = "SELECT id, firstname, lastname
FROM session
WHERE oauth_foreign_id = $1
OR oauth_foreign_id LIKE $2
LIMIT 30";
Ok(self.query_map_many(query, &[&pms_id], |row| (row.get(0), row.get(1), row.get(2))).unwrap())
Ok(self.query_map_many(query, &[&pms_id, &format!("{}/%", pms_id)], |row| (row.get(0), row.get(1), row.get(2))).unwrap())
} else if let (Some(firstname), Some(lastname)) = (s_firstname, s_lastname) {
let query = "SELECT id, firstname, lastname
FROM session
WHERE firstname LIKE $1
AND lastname LIKE $2
WHERE firstname ILIKE $1
AND lastname ILIKE $2
LIMIT 30";
Ok(self.query_map_many(query, &[&firstname, &lastname], |row| (row.get(0), row.get(1), row.get(2)))
.unwrap())
......
......@@ -1542,13 +1542,14 @@ impl MedalConnection for Connection {
let query = "SELECT id, firstname, lastname
FROM session
WHERE oauth_foreign_id = $1
OR oauth_foreign_id LIKE $2
LIMIT 30";
Ok(self.query_map_many(query, &[&pms_id], |row| (row.get(0), row.get(1), row.get(2))).unwrap())
Ok(self.query_map_many(query, &[&pms_id, &format!("{}/%", pms_id)], |row| (row.get(0), row.get(1), row.get(2))).unwrap())
} else if let (Some(firstname), Some(lastname)) = (s_firstname, s_lastname) {
let query = "SELECT id, firstname, lastname
FROM session
WHERE firstname LIKE $1
AND lastname LIKE $2
WHERE firstname ILIKE $1
AND lastname ILIKE $2
LIMIT 30";
Ok(self.query_map_many(query, &[&firstname, &lastname], |row| (row.get(0), row.get(1), row.get(2)))
.unwrap())
......
......@@ -1542,8 +1542,9 @@ impl MedalConnection for Connection {
let query = "SELECT id, firstname, lastname
FROM session
WHERE oauth_foreign_id = ?1
OR oauth_foreign_id LIKE ?2
LIMIT 30";
Ok(self.query_map_many(query, &[&pms_id], |row| (row.get(0), row.get(1), row.get(2))).unwrap())
Ok(self.query_map_many(query, &[&pms_id, &format!("{}/%", pms_id)], |row| (row.get(0), row.get(1), row.get(2))).unwrap())
} else if let (Some(firstname), Some(lastname)) = (s_firstname, s_lastname) {
let query = "SELECT id, firstname, lastname
FROM session
......
#!/bin/sh
cat db_conn_warning_header.txt db_conn_sqlite_new.header.rs db_conn.base.rs | sed 's/\$/\?/g' | sed 's/{ "postgres" }/{ "sqlite_v2" }/' | sed 's/batch_execute/execute_batch/' > db_conn_sqlite_new.rs
cat db_conn_warning_header.txt db_conn_sqlite_new.header.rs db_conn.base.rs | sed 's/\$/\?/g' | sed 's/{ "postgres" }/{ "sqlite_v2" }/' | sed 's/batch_execute/execute_batch/' | sed 's/ILIKE/LIKE/' > db_conn_sqlite_new.rs
cat db_conn_warning_header.txt db_conn_postgres.header.rs db_conn.base.rs > db_conn_postgres.rs
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment