Skip to content

Commit

Permalink
Fix #283
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAxelander committed Jan 11, 2025
1 parent 2812b74 commit 1e15727
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## 1.9.1 (2025-01-09)
## 1.9.1 (2025-01-11)

### :beetle: Bug Fixes

* Unable to move a Bucket Group [#282](https://github.com/TheAxelander/OpenBudgeteer/issues/282)
* Data Inconsistency Check for incomplete Bucket assignments didn't cover Transactions without any assignment [#283](https://github.com/TheAxelander/OpenBudgeteer/issues/283)

## 1.9 (2025-01-04)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,33 @@ public async Task<DataConsistencyCheckResult> CheckBankTransactionIncompleteBuck
{
const string checkName = "Transactions with incomplete bucket assignment";
var results = new List<Tuple<DataConsistencyCheckResult.StatusCode, string[]>>();

// Check on Transactions which have overall no Bucket assignments
var unassignedTransactions = ServiceManager.BankTransactionService
.GetAll(DateTime.MinValue, DateTime.MaxValue)
.GroupJoin(
ServiceManager.BudgetedTransactionService.GetAll(DateTime.MinValue, DateTime.MaxValue),
transaction => transaction.Id,
budgetedTransaction => budgetedTransaction.TransactionId,
(bankTransaction, budgetedTransactions) => new
{ BankTransaction = bankTransaction, BudgetedTransactions = budgetedTransactions })
.Where(i => !i.BudgetedTransactions.Any())
.Select(i => i.BankTransaction)
.ToList();

foreach (var unassignedTransaction in unassignedTransactions)
{
results.Add(new(
DataConsistencyCheckResult.StatusCode.Warning,
[
unassignedTransaction.TransactionDate.ToShortDateString(),
unassignedTransaction.Memo ?? string.Empty,
unassignedTransaction.Amount.ToString("C", CultureInfo.CurrentCulture),
new decimal(0).ToString("C", CultureInfo.CurrentCulture)
]));
}

// Check on incomplete assignments
var findings =
// Get all BudgetedTransaction which are not 1:1 budgeted (Missing Assignments or Split Transaction)
ServiceManager.BudgetedTransactionService.GetAll(DateTime.MinValue, DateTime.MaxValue)
Expand All @@ -158,14 +185,13 @@ public async Task<DataConsistencyCheckResult> CheckBankTransactionIncompleteBuck
foreach (var finding in findings)
{
results.Add(new(
DataConsistencyCheckResult.StatusCode.Warning,
new[]
{
DataConsistencyCheckResult.StatusCode.Warning,
[
finding.Transaction.TransactionDate.ToShortDateString(),
finding.Transaction.Memo ?? string.Empty,
finding.TransactionAmount.ToString("C", CultureInfo.CurrentCulture),
finding.BudgetedAmount.ToString("C", CultureInfo.CurrentCulture)
}));
]));
}

if (!results.Any())
Expand Down

0 comments on commit 1e15727

Please sign in to comment.