mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 09:35:28 +00:00
remove duplicated constructions
This commit is contained in:
parent
bd1ebfcb0f
commit
53694506f3
1 changed files with 1 additions and 6 deletions
|
|
@ -28,21 +28,16 @@ impl Database {
|
||||||
pub fn records(&self) -> Vec<Table> {
|
pub fn records(&self) -> Vec<Table> {
|
||||||
let binding = self.connection.read().unwrap();
|
let binding = self.connection.read().unwrap();
|
||||||
let tx = binding.unchecked_transaction().unwrap();
|
let tx = binding.unchecked_transaction().unwrap();
|
||||||
|
|
||||||
records(&tx).unwrap()
|
records(&tx).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get selected profile record if exist
|
/// Get selected profile record if exist
|
||||||
pub fn selected(&self) -> Option<Table> {
|
pub fn selected(&self) -> Option<Table> {
|
||||||
let binding = self.connection.read().unwrap();
|
for record in self.records() {
|
||||||
let tx = binding.unchecked_transaction().unwrap();
|
|
||||||
|
|
||||||
for record in records(&tx).unwrap() {
|
|
||||||
if record.is_active {
|
if record.is_active {
|
||||||
return Some(record);
|
return Some(record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue