Skip to content

Commit 6f1cc8e

Browse files
authored
Merge pull request #10 from cardano-foundation/fix/batch_statistic
fix: transaction statistic calculation
2 parents 7a218de + 9e4c9c8 commit 6f1cc8e

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

accounting_reporting_core/src/main/java/org/cardanofoundation/lob/app/accounting_reporting_core/resource/model/AccountingCorePresentationViewService.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ private BatchStatisticsView getStatisticts(Optional<BatchStatistics> batchStatis
7777
Optional<BatchStatistics> statistics = batchStatistics.stream().findFirst();
7878

7979
return new BatchStatisticsView(
80-
statistics.flatMap(BatchStatistics::getProcessedTransactionsCount).orElse(0),
81-
Math.abs(statistics.flatMap(BatchStatistics::getFailedTransactionsCount).orElse(0) - statistics.flatMap(BatchStatistics::getApprovedTransactionsCount).orElse(0)),
82-
statistics.flatMap(BatchStatistics::getFailedTransactionsCount).orElse(0),
8380
statistics.flatMap(BatchStatistics::getApprovedTransactionsCount).orElse(0),
84-
statistics.flatMap(BatchStatistics::getFinalizedTransactionsCount).orElse(0),
81+
Math.abs(statistics.flatMap(BatchStatistics::getTotalTransactionsCount).orElse(0) - statistics.flatMap(BatchStatistics::getDispatchedTransactionsCount).orElse(0)),
82+
statistics.flatMap(BatchStatistics::getFailedTransactionsCount).orElse(0),
83+
statistics.flatMap(BatchStatistics::getDispatchedTransactionsCount).orElse(0),
84+
statistics.flatMap(BatchStatistics::getCompletedTransactionsCount).orElse(0),
8585
statistics.flatMap(BatchStatistics::getTotalTransactionsCount).orElse(0)
8686
);
8787

accounting_reporting_core/src/test/java/org/cardanofoundation/lob/app/accounting_reporting_core/resource/model/AccountingCorePresentationConverterTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ void testBatchDetail() {
189189
assertEquals(batchId, result.get().getId());
190190
assertEquals(10, result.get().getBatchStatistics().getTotal());
191191
assertEquals(1, result.get().getBatchStatistics().getInvalid());
192-
assertEquals(9, result.get().getBatchStatistics().getPublish());
193-
assertEquals(8, result.get().getBatchStatistics().getPending());
194-
assertEquals(6, result.get().getBatchStatistics().getPublished());
195-
assertEquals(8, result.get().getBatchStatistics().getApprove());
192+
assertEquals(0, result.get().getBatchStatistics().getPublish());
193+
assertEquals(10, result.get().getBatchStatistics().getPending());
194+
assertEquals(0, result.get().getBatchStatistics().getPublished());
195+
assertEquals(9, result.get().getBatchStatistics().getApprove());
196196
assertEquals(2, result.get().getTransactions().stream().count());
197197

198198
TransactionView resultTx1 = result.get().getTransactions().stream().filter(

0 commit comments

Comments
 (0)