|
@@ -153,7 +153,9 @@ fn check_balance_group<'a>(
|
|
.unwrap()
|
|
.unwrap()
|
|
.union(first.change_for(account).unwrap().source.unwrap()),
|
|
.union(first.change_for(account).unwrap().source.unwrap()),
|
|
)
|
|
)
|
|
- .with_message(format!("No valid ordering of transactions to satisfy balance assertions in {account}"))
|
|
|
|
|
|
+ .with_message(format!(
|
|
|
|
+ "No valid ordering of transactions to satisfy balance assertions in {account}"
|
|
|
|
+ ))
|
|
.with_labels(group.iter().map(|txn| {
|
|
.with_labels(group.iter().map(|txn| {
|
|
let txn = txn.borrow();
|
|
let txn = txn.borrow();
|
|
let span = txn
|
|
let span = txn
|
|
@@ -162,7 +164,9 @@ fn check_balance_group<'a>(
|
|
.union(txn.change_for(account).unwrap().source.unwrap());
|
|
.union(txn.change_for(account).unwrap().source.unwrap());
|
|
ariadne::Label::new(span).with_message("transaction in group")
|
|
ariadne::Label::new(span).with_message("transaction in group")
|
|
}))
|
|
}))
|
|
- .with_labels(last_bal.iter().map(|bal| ariadne::Label::new(bal.span()).with_message(format!("last calculated balance was {bal}"))))
|
|
|
|
|
|
+ .with_labels(last_bal.iter().map(|bal| {
|
|
|
|
+ ariadne::Label::new(bal.span()).with_message(format!("last calculated balance was {bal}"))
|
|
|
|
+ }))
|
|
.finish();
|
|
.finish();
|
|
|
|
|
|
Err(DataError::Report(Box::new(report)))
|
|
Err(DataError::Report(Box::new(report)))
|
|
@@ -177,7 +181,9 @@ fn check_balances(root: &data::Hoard) -> Result<(), DataError> {
|
|
};
|
|
};
|
|
|
|
|
|
let mut running_balance = BTreeMap::<data::UnitName, Spanned<data::Decimal>>::new();
|
|
let mut running_balance = BTreeMap::<data::UnitName, Spanned<data::Decimal>>::new();
|
|
- let date_groups = ledger.iter().chunk_by(|tx| tx.borrow().datestamp_for(account));
|
|
|
|
|
|
+ let date_groups = ledger
|
|
|
|
+ .iter()
|
|
|
|
+ .chunk_by(|tx| tx.borrow().datestamp_for(account));
|
|
|
|
|
|
for group in date_groups.into_iter() {
|
|
for group in date_groups.into_iter() {
|
|
check_balance_group(account, &mut running_balance, group.1)?;
|
|
check_balance_group(account, &mut running_balance, group.1)?;
|
|
@@ -195,7 +201,12 @@ fn check_merge_groups(root: &data::Hoard) -> Result<(), DataError> {
|
|
span = span.union(ds.span());
|
|
span = span.union(ds.span());
|
|
}
|
|
}
|
|
|
|
|
|
- (Spanned::new((), span), c.account.0, c.amount.0, c.datestamp.map(|d| d.0).unwrap_or(txn.datestamp))
|
|
|
|
|
|
+ (
|
|
|
|
+ Spanned::new((), span),
|
|
|
|
+ c.account.0,
|
|
|
|
+ c.amount.0,
|
|
|
|
+ c.datestamp.map(|d| d.0).unwrap_or(txn.datestamp),
|
|
|
|
+ )
|
|
};
|
|
};
|
|
|
|
|
|
for account in root.account_names() {
|
|
for account in root.account_names() {
|