From ceea9aa0ec0d81c45db8f5f78478389c405ffd64 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Fri, 14 May 2021 17:48:42 +0200 Subject: [PATCH 1/2] raise coverage for frontend unit tets to 18 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 320a9cfea..4f887aa14 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -212,7 +212,7 @@ jobs: report_name: Coverage Frontend type: lcov result_path: ./coverage/lcov.info - min_coverage: 15 + min_coverage: 18 token: ${{ github.token }} #test: From b44e3e3196473ece5ff556b1680010a837010e0d Mon Sep 17 00:00:00 2001 From: Dario Rekowski on RockPI Date: Mon, 17 May 2021 11:15:02 +0000 Subject: [PATCH 2/2] ceil the last decay --- community_server/src/Model/Table/TransactionsTable.php | 1 + .../src/Template/AppRequests/list_transactions.ctp | 6 +++++- community_server/src/Template/Element/centToFloat.ctp | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/community_server/src/Model/Table/TransactionsTable.php b/community_server/src/Model/Table/TransactionsTable.php index f2bf1437f..c4bc4b698 100644 --- a/community_server/src/Model/Table/TransactionsTable.php +++ b/community_server/src/Model/Table/TransactionsTable.php @@ -275,6 +275,7 @@ class TransactionsTable extends Table 'type' => 'decay', 'balance' => $balance, 'decay_duration' => $duration, + 'last_decay' => true, 'memo' => '' ]; } diff --git a/community_server/src/Template/AppRequests/list_transactions.ctp b/community_server/src/Template/AppRequests/list_transactions.ctp index 28a76f2be..d7a8b1d6f 100644 --- a/community_server/src/Template/AppRequests/list_transactions.ctp +++ b/community_server/src/Template/AppRequests/list_transactions.ctp @@ -11,7 +11,11 @@ $body['decay'] = $this->element('centToFloat', ['cent' => $body['decay'], 'preci $body['gdtSum'] = $this->element('centToFloat', ['cent' => $body['gdtSum'], 'precision' => 2]); foreach($body['transactions'] as $i => $transaction) { - $body['transactions'][$i]['balance'] = $this->element('centToFloat', ['cent' => $transaction['balance'], 'precision' => 4]); + $useCeil = false; + if(isset($transaction['last_decay']) && $transaction['last_decay']) { + $useCeil = true; + } + $body['transactions'][$i]['balance'] = $this->element('centToFloat', ['cent' => $transaction['balance'], 'precision' => 4, 'useCeil' => $useCeil]); if(isset($transaction['creation_amount'])) { $body['transactions'][$i]['creation_amount'] = $this->element('centToFloat', ['cent' => $transaction['creation_amount'], 'precision' => 4]); } diff --git a/community_server/src/Template/Element/centToFloat.ctp b/community_server/src/Template/Element/centToFloat.ctp index 2fade18b2..3beabf837 100644 --- a/community_server/src/Template/Element/centToFloat.ctp +++ b/community_server/src/Template/Element/centToFloat.ctp @@ -9,7 +9,11 @@ $cut_places = $precision - 2; $transformAmount = $cent; if($cut_places > 0) { - $transformAmount = floor($cent / pow(10, $cut_places)); + if(isset($useCeil) && $useCeil) { + $transformAmount = ceil($cent / pow(10, $cut_places)); + } else { + $transformAmount = floor($cent / pow(10, $cut_places)); + } } if($cut_places < 0) { $cut_places = 0;