Skip to content
Snippets Groups Projects
Commit b8b84b58 authored by Robert Goldmann's avatar Robert Goldmann
Browse files

Fixed #449 - transactions page for all accounts shows all transactions

parent 625e1130
No related branches found
No related tags found
No related merge requests found
Pipeline #1821 passed
......@@ -96,7 +96,7 @@ public class TransactionSpecifications
if(transferBackReference == null)
{
return builder.and(predicates.toArray(predicatesArray));
return builder.and(dateConstraint, builder.or(builder.and(predicates.toArray(predicatesArray))));
}
return builder.and(dateConstraint, builder.or(builder.and(predicates.toArray(predicatesArray)), transferBackReference));
......
......@@ -94,7 +94,7 @@ public class TransactionSpecificationsTest
transaction2 = new Transaction();
transaction2.setName("Test_2");
transaction2.setAmount(-525);
transaction2.setDate(new DateTime(2018, 10, 3, 12, 0, 0, 0));
transaction2.setDate(new DateTime(2018, 12, 3, 12, 0, 0, 0));
transaction2.setCategory(category2);
transaction2.setAccount(account);
transaction2 = transactionRepository.save(transaction2);
......@@ -379,4 +379,17 @@ public class TransactionSpecificationsTest
assertTrue(results.contains(repeatingTransaction));
assertFalse(results.contains(transferTransaction));
}
@Test
public void getFromAllAccountsExceptTransfersWithSpecificEndDate()
{
DateTime endDate = new DateTime(2018, 11, 30, 12, 0, 0, 0);
Specification spec = TransactionSpecifications.withDynamicQuery(startDate, endDate, null, true, true, false, null, null, null, null);
List<Transaction> results = transactionRepository.findAll(spec);
assertTrue(results.contains(transaction1));
assertFalse(results.contains(transaction2));
assertTrue(results.contains(repeatingTransaction));
assertFalse(results.contains(transferTransaction));
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment