Skip to content

Commit

Permalink
Merge branch 'afk11-bug-with-checkpoints' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ar committed Aug 25, 2020
2 parents 4ca2146 + ba24292 commit aabcd4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions modules/minigl/src/main/java/org/jpos/gl/Checkpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public String toString() {
.append("layers", getLayers())
.append("journal", getJournal())
.append("account", getAccount())
.append("balance", getBalance())
.toString();
}

Expand Down
2 changes: 1 addition & 1 deletion modules/minigl/src/main/java/org/jpos/gl/GLSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ else if (acct.isFinalAccount()) {
Checkpoint chkp = getRecentCheckpoint (journal, acct, date, inclusive, layersCopy);
if (chkp != null) {
balance[0] = chkp.getBalance();
txnCrit.add (Restrictions.gt ("postDate", chkp.getDate()));
txnCrit.add (Restrictions.ge ("postDate", chkp.getDate()));
}
} else if (!ignoreBalanceCache) {
BalanceCache bcache = getBalanceCache (journal, acct, layersCopy);
Expand Down
7 changes: 7 additions & 0 deletions modules/minigl/src/test/java/org/jpos/gl/BalanceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ public void testBalancesByPostDate() throws Exception {
@Test
@Order(3)
public void testCheckpoints() throws Exception {
final Transaction tx1 = gls.beginTransaction();
gls.createCheckpoint (tj, root, Util.parseDate ("20041231"), 1);
gls.createCheckpoint (tj, root, Util.parseDate ("20050101"), 1);
gls.createCheckpoint (tj, root, Util.parseDate ("20050102"), 1);
tx1.commit();
}
@Test
@Order(4)
Expand Down Expand Up @@ -278,6 +280,11 @@ private void checkBalancesByPostDate () throws Exception {
new BigDecimal("15000.00"),
gls.getBalance (tj, cashUS, Util.parseDate ("20050101"))
);
short[] zeroOnly = {0};
assertEquals (
new BigDecimal("25000.00"),
gls.getBalancesORM (tj, cashUS, Util.parseDate ("20050102"), true, zeroOnly, 0)[0]
);
assertEquals (
new BigDecimal("25000.00"),
gls.getBalance (tj, cashUS, Util.parseDate ("20050102"))
Expand Down

0 comments on commit aabcd4b

Please sign in to comment.