Skip to content

Commit 4a8a84f

Browse files
authored
Merge pull request #284 from TheAxelander/pre-release
2 parents 57c62b0 + 1e15727 commit 4a8a84f

File tree

5 files changed

+49
-14
lines changed

5 files changed

+49
-14
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 1.9.1 (2025-01-11)
2+
3+
### :beetle: Bug Fixes
4+
5+
* Unable to move a Bucket Group [#282](https://github.com/TheAxelander/OpenBudgeteer/issues/282)
6+
* Data Inconsistency Check for incomplete Bucket assignments didn't cover Transactions without any assignment [#283](https://github.com/TheAxelander/OpenBudgeteer/issues/283)
7+
18
## 1.9 (2025-01-04)
29

310
### :gear: Features & Enhancements

OpenBudgeteer.Blazor/Shared/MainLayout.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</button>
1717
<span class="navbar-brand flex-fill ms-2 fs-5">OpenBudgeteer</span>
1818
<span class="navbar-text ms-3 d-none d-md-block">Database: @CurrentDatabase</span>
19-
<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>
19+
<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>
2020
</div>
2121
</header>
2222
<div class="container-fluid">

OpenBudgeteer.Core.Data.Services/Generic/GenericBucketGroupService.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,31 +103,33 @@ public override void Delete(Guid id)
103103

104104
public BucketGroup Move(Guid bucketGroupId, int positions)
105105
{
106-
var bucketGroup = Get(bucketGroupId);
107-
if (positions == 0) return bucketGroup;
108-
109-
// Create in an interim List for later use
106+
// Create in an interim list to handle position updates
110107
var existingBucketGroups = new ObservableCollection<BucketGroup>();
111108
foreach (var group in GetAll().ToList())
112109
{
113110
existingBucketGroups.Add(group);
114111
}
112+
113+
// Re-use existing reference in interim list of passed Bucket Group (see #282)
114+
var bucketGroup = existingBucketGroups.First(i => i.Id == bucketGroupId);
115+
if (positions == 0) return bucketGroup;
116+
117+
// Calculate new target position
115118
var bucketGroupCount = existingBucketGroups.Count();
116119
var targetPosition = bucketGroup.Position + positions;
117120
if (targetPosition < 1) targetPosition = 1;
118121
if (targetPosition > bucketGroupCount) targetPosition = bucketGroupCount;
119122
if (targetPosition == bucketGroup.Position) return bucketGroup; // Group is already at the end or top. No further action
120123

121-
// Move Group in interim List
124+
// Move Group in interim list
122125
existingBucketGroups.Move(bucketGroup.Position - 1, targetPosition - 1);
123126

124-
// Update Position number
127+
// Update Position number for each group
125128
var newPosition = 1;
126129
foreach (var group in existingBucketGroups)
127130
{
128131
group.Position = newPosition;
129132
_bucketGroupRepository.Update(group);
130-
if (group.Id == bucketGroupId) bucketGroup = group; // Use correct object reference for final return
131133
newPosition++;
132134
}
133135

OpenBudgeteer.Core/ViewModels/PageViewModels/DataConsistencyPageViewModel.cs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,33 @@ public async Task<DataConsistencyCheckResult> CheckBankTransactionIncompleteBuck
134134
{
135135
const string checkName = "Transactions with incomplete bucket assignment";
136136
var results = new List<Tuple<DataConsistencyCheckResult.StatusCode, string[]>>();
137+
138+
// Check on Transactions which have overall no Bucket assignments
139+
var unassignedTransactions = ServiceManager.BankTransactionService
140+
.GetAll(DateTime.MinValue, DateTime.MaxValue)
141+
.GroupJoin(
142+
ServiceManager.BudgetedTransactionService.GetAll(DateTime.MinValue, DateTime.MaxValue),
143+
transaction => transaction.Id,
144+
budgetedTransaction => budgetedTransaction.TransactionId,
145+
(bankTransaction, budgetedTransactions) => new
146+
{ BankTransaction = bankTransaction, BudgetedTransactions = budgetedTransactions })
147+
.Where(i => !i.BudgetedTransactions.Any())
148+
.Select(i => i.BankTransaction)
149+
.ToList();
150+
151+
foreach (var unassignedTransaction in unassignedTransactions)
152+
{
153+
results.Add(new(
154+
DataConsistencyCheckResult.StatusCode.Warning,
155+
[
156+
unassignedTransaction.TransactionDate.ToShortDateString(),
157+
unassignedTransaction.Memo ?? string.Empty,
158+
unassignedTransaction.Amount.ToString("C", CultureInfo.CurrentCulture),
159+
new decimal(0).ToString("C", CultureInfo.CurrentCulture)
160+
]));
161+
}
162+
163+
// Check on incomplete assignments
137164
var findings =
138165
// Get all BudgetedTransaction which are not 1:1 budgeted (Missing Assignments or Split Transaction)
139166
ServiceManager.BudgetedTransactionService.GetAll(DateTime.MinValue, DateTime.MaxValue)
@@ -158,14 +185,13 @@ public async Task<DataConsistencyCheckResult> CheckBankTransactionIncompleteBuck
158185
foreach (var finding in findings)
159186
{
160187
results.Add(new(
161-
DataConsistencyCheckResult.StatusCode.Warning,
162-
new[]
163-
{
188+
DataConsistencyCheckResult.StatusCode.Warning,
189+
[
164190
finding.Transaction.TransactionDate.ToShortDateString(),
165191
finding.Transaction.Memo ?? string.Empty,
166192
finding.TransactionAmount.ToString("C", CultureInfo.CurrentCulture),
167193
finding.BudgetedAmount.ToString("C", CultureInfo.CurrentCulture)
168-
}));
194+
]));
169195
}
170196

171197
if (!results.Any())

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
| Version | Supported |
66
|-------------| ------------------ |
7-
| 1.9 | :white_check_mark: |
7+
| 1.9.1 | :white_check_mark: |
88
| pre-release | :white_check_mark: |
9-
| < 1.9 | :x: |
9+
| < 1.9.1 | :x: |
1010

1111
## Reporting a Vulnerability
1212

0 commit comments

Comments
 (0)