Skip to content

Commit

Permalink
Merge pull request #284 from TheAxelander/pre-release
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAxelander authored Jan 11, 2025
2 parents 57c62b0 + 1e15727 commit 4a8a84f
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 14 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 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)

### :gear: Features & Enhancements
Expand Down
2 changes: 1 addition & 1 deletion OpenBudgeteer.Blazor/Shared/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</button>
<span class="navbar-brand flex-fill ms-2 fs-5">OpenBudgeteer</span>
<span class="navbar-text ms-3 d-none d-md-block">Database: @CurrentDatabase</span>
<span class="navbar-text ms-3 d-none d-md-block">Version: 1.9.0 (<a href="https://github.com/TheAxelander/OpenBudgeteer/blob/master/CHANGELOG.md" target="_blank">Change Log</a>)</span>
<span class="navbar-text ms-3 d-none d-md-block">Version: 1.9.1 (<a href="https://github.com/TheAxelander/OpenBudgeteer/blob/master/CHANGELOG.md" target="_blank">Change Log</a>)</span>
</div>
</header>
<div class="container-fluid">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,31 +103,33 @@ public override void Delete(Guid id)

public BucketGroup Move(Guid bucketGroupId, int positions)
{
var bucketGroup = Get(bucketGroupId);
if (positions == 0) return bucketGroup;

// Create in an interim List for later use
// Create in an interim list to handle position updates
var existingBucketGroups = new ObservableCollection<BucketGroup>();
foreach (var group in GetAll().ToList())
{
existingBucketGroups.Add(group);
}

// Re-use existing reference in interim list of passed Bucket Group (see #282)
var bucketGroup = existingBucketGroups.First(i => i.Id == bucketGroupId);
if (positions == 0) return bucketGroup;

// Calculate new target position
var bucketGroupCount = existingBucketGroups.Count();
var targetPosition = bucketGroup.Position + positions;
if (targetPosition < 1) targetPosition = 1;
if (targetPosition > bucketGroupCount) targetPosition = bucketGroupCount;
if (targetPosition == bucketGroup.Position) return bucketGroup; // Group is already at the end or top. No further action

// Move Group in interim List
// Move Group in interim list
existingBucketGroups.Move(bucketGroup.Position - 1, targetPosition - 1);

// Update Position number
// Update Position number for each group
var newPosition = 1;
foreach (var group in existingBucketGroups)
{
group.Position = newPosition;
_bucketGroupRepository.Update(group);
if (group.Id == bucketGroupId) bucketGroup = group; // Use correct object reference for final return
newPosition++;
}

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
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

| Version | Supported |
|-------------| ------------------ |
| 1.9 | :white_check_mark: |
| 1.9.1 | :white_check_mark: |
| pre-release | :white_check_mark: |
| < 1.9 | :x: |
| < 1.9.1 | :x: |

## Reporting a Vulnerability

Expand Down

0 comments on commit 4a8a84f

Please sign in to comment.