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.bugfix/ci-buildah
parent
f3d31a7256
commit
e158a095d3
|
@ -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) => {
|
Ok(t) => {
|
||||||
let mut needs_update = false;
|
let mut needs_update = false;
|
||||||
let mut update = TransactionUpdate::from(t.data.clone());
|
let mut update = TransactionUpdate::from(t.data.clone());
|
||||||
|
@ -166,6 +170,7 @@ pub async fn add_receipt(
|
||||||
None
|
None
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Some(_) => None,
|
||||||
None => None,
|
None => None,
|
||||||
};
|
};
|
||||||
if let Some(xact) = xact {
|
if let Some(xact) = xact {
|
||||||
|
|
Loading…
Reference in New Issue