START bookings optimizations
This commit is contained in:
@@ -36,8 +36,13 @@ public class AccountStatisticService {
|
|||||||
public void calculateStatistics(Transaction transaction) {
|
public void calculateStatistics(Transaction transaction) {
|
||||||
final Account fromAccount = transaction.getFromAccount();
|
final Account fromAccount = transaction.getFromAccount();
|
||||||
final Account toAccount = transaction.getToAccount();
|
final Account toAccount = transaction.getToAccount();
|
||||||
final long amount = transaction.getAmount();
|
|
||||||
final List<AccountStatistic> resultList = new ArrayList<>();
|
final List<AccountStatistic> resultList = new ArrayList<>();
|
||||||
|
long amount = transaction.getAmount();
|
||||||
|
|
||||||
|
// Special case: START bookings should not increase 'spendings current period'
|
||||||
|
if (AccountType.START.equals(fromAccount.getType())) {
|
||||||
|
amount = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for (final Period period : transaction.getPeriods()) {
|
for (final Period period : transaction.getPeriods()) {
|
||||||
resultList.add(calculateInternal(fromAccount, period, amount, true, 1));
|
resultList.add(calculateInternal(fromAccount, period, amount, true, 1));
|
||||||
|
|||||||
@@ -98,6 +98,12 @@ public class TransactionService {
|
|||||||
.getMultiplierToAccount(toAccount) * amount));
|
.getMultiplierToAccount(toAccount) * amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special case: START bookings should not be counted towards 'expenses current period'
|
||||||
|
// as booking e.g. a mortgage of 250,000 looks kinda ugly then
|
||||||
|
if (AccountType.START.equals(fromAccount.getType())) {
|
||||||
|
transaction.setExpenseNeutral(true);
|
||||||
|
}
|
||||||
|
|
||||||
this.transactionRepository.save(transaction);
|
this.transactionRepository.save(transaction);
|
||||||
|
|
||||||
this.accountStatisticService.calculateStatistics(transaction);
|
this.accountStatisticService.calculateStatistics(transaction);
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
v36 -> v37:
|
||||||
|
- START bookings are now expense neutral, so they do not increase the 'Expenses current period' counter
|
||||||
|
- START bookings now do not increase 'Spendings current period' as this distorts this counter
|
||||||
|
|
||||||
v35 -> v36:
|
v35 -> v36:
|
||||||
- Add demo deployment profile
|
- Add demo deployment profile
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user