mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Refactor calculation of next working set ID
As per Dustin's code-review comment
This commit is contained in:
parent
1d62799437
commit
89e9a42374
1 changed files with 3 additions and 3 deletions
|
@ -112,14 +112,14 @@ impl<'t> Txn<'t> {
|
|||
|
||||
fn get_next_working_set_number(&self) -> anyhow::Result<usize> {
|
||||
let t = self.get_txn()?;
|
||||
let result: Option<usize> = t
|
||||
.query_row("SELECT COALESCE(MAX(id), 0) FROM working_set", [], |r| {
|
||||
let next_id: Option<usize> = t
|
||||
.query_row("SELECT COALESCE(MAX(id), 0) + 1 FROM working_set", [], |r| {
|
||||
r.get(0)
|
||||
})
|
||||
.optional()
|
||||
.context("Getting highest working set ID")?;
|
||||
|
||||
Ok(result.unwrap_or(0) + 1)
|
||||
Ok(next_id.unwrap_or(0))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue