mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
remove duplicated constructions
This commit is contained in:
parent
bd1ebfcb0f
commit
53694506f3
@ -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…
x
Reference in New Issue
Block a user