Change account sort order in overview page

This commit is contained in:
2020-01-21 14:56:50 +01:00
parent cdd020fccc
commit 1a5925f6f1
2 changed files with 12 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package de.financer.util.comparator;
import de.financer.model.Account;
import de.financer.model.AccountType;
import org.apache.commons.lang3.StringUtils;
import java.util.Comparator;
import java.util.Map;
@@ -19,7 +20,13 @@ public class AccountByTypeByIdComparator implements Comparator<Account> {
@Override
public int compare(Account o1, Account o2) {
int typeOrder = SORT_ORDER.get(o1.getType()).compareTo(SORT_ORDER.get(o2.getType()));
int groupOrder = 0;
int idOrder = o1.getId().compareTo(o2.getId());
return typeOrder != 0 ? typeOrder : o1.getId().compareTo(o2.getId());
if (o1.getAccountGroup() != null && o2.getAccountGroup() != null) {
groupOrder = o1.getAccountGroup().getName().compareTo(o2.getAccountGroup().getName());
}
return typeOrder != 0 ? typeOrder : groupOrder != 0 ? groupOrder : idOrder;
}
}

View File

@@ -1,3 +1,7 @@
v26 -> v27:
- Changed sort order of accounts in overview page. The accounts are now sorted by the account type first (BCILES), then
by the account group name and then by the account ID, leading to an overall more organic order of accounts
v25 -> v26:
- Close of the current expense period now creates null statistic entries for accounts that have not been used in
bookings in the period to close. This way the average spending better reflects the period average