receipts/add: Do not query Firefly for empty ID
The `transaction` field is usually included in the form submission, even if it is empty. To avoid querying Firefly for an invalid ID and logging a useless error about it, we only query if the field is non-empty.
This commit is contained in:
@@ -113,7 +113,11 @@ pub async fn add_receipt(
|
||||
},
|
||||
}
|
||||
},
|
||||
Some(ref id) => match ctx.firefly.get_transaction(id).await {
|
||||
Some(ref id) if !id.is_empty() => match ctx
|
||||
.firefly
|
||||
.get_transaction(id)
|
||||
.await
|
||||
{
|
||||
Ok(t) => {
|
||||
let mut needs_update = false;
|
||||
let mut update = TransactionUpdate::from(t.data.clone());
|
||||
@@ -166,6 +170,7 @@ pub async fn add_receipt(
|
||||
None
|
||||
},
|
||||
},
|
||||
Some(_) => None,
|
||||
None => None,
|
||||
};
|
||||
if let Some(xact) = xact {
|
||||
|
||||
Reference in New Issue
Block a user