mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
cleanup unused constructions, fix tab state for bookmark action
This commit is contained in:
parent
c511b97d2d
commit
fb8f9904d0
8 changed files with 13 additions and 190 deletions
|
|
@ -4,7 +4,7 @@ use std::{rc::Rc, sync::RwLock};
|
|||
|
||||
pub struct Table {
|
||||
pub id: i64,
|
||||
pub profile_id: i64,
|
||||
//pub profile_id: i64,
|
||||
pub time: DateTime,
|
||||
pub request: String,
|
||||
}
|
||||
|
|
@ -112,15 +112,10 @@ pub fn select(
|
|||
WHERE `profile_id` = ? AND `request` LIKE ?",
|
||||
)?;
|
||||
|
||||
let filter = match request {
|
||||
Some(value) => value,
|
||||
None => "%",
|
||||
};
|
||||
|
||||
let result = stmt.query_map((profile_id, filter), |row| {
|
||||
let result = stmt.query_map((profile_id, request.unwrap_or("%")), |row| {
|
||||
Ok(Table {
|
||||
id: row.get(0)?,
|
||||
profile_id: row.get(1)?,
|
||||
//profile_id: row.get(1)?,
|
||||
time: DateTime::from_unix_local(row.get(2)?).unwrap(),
|
||||
request: row.get(3)?,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -32,12 +32,7 @@ impl Database {
|
|||
|
||||
/// Get active profile record if exist
|
||||
pub fn active(&self) -> Option<Table> {
|
||||
for record in self.records() {
|
||||
if record.is_active {
|
||||
return Some(record);
|
||||
}
|
||||
}
|
||||
None
|
||||
self.records().into_iter().find(|record| record.is_active)
|
||||
}
|
||||
|
||||
// Setters
|
||||
|
|
@ -69,6 +64,7 @@ impl Database {
|
|||
}
|
||||
}
|
||||
|
||||
/* @TODO not in use
|
||||
/// Set `is_active` status `true` for the record with given profile ID
|
||||
/// * reset other records to `false`
|
||||
pub fn activate(&self, id: i64) -> Result<(), ()> {
|
||||
|
|
@ -92,7 +88,7 @@ impl Database {
|
|||
Ok(_) => Ok(()),
|
||||
Err(_) => Err(()),
|
||||
} // @TODO make sure ID exist and was changed
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
// Low-level DB API
|
||||
|
|
|
|||
|
|
@ -54,12 +54,7 @@ pub fn select(
|
|||
WHERE `profile_id` = ? AND `request` LIKE ?",
|
||||
)?;
|
||||
|
||||
let filter = match request {
|
||||
Some(value) => value,
|
||||
None => format!("%"),
|
||||
};
|
||||
|
||||
let result = stmt.query_map((profile_id, filter), |row| {
|
||||
let result = stmt.query_map((profile_id, request.unwrap_or("%")), |row| {
|
||||
Ok(Table {
|
||||
id: row.get(0)?,
|
||||
profile_id: row.get(1)?,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue