remove duplicated constructions

This commit is contained in:
yggverse 2024-11-13 08:07:32 +02:00
parent bd1ebfcb0f
commit 53694506f3

View File

@ -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
} }
} }