diff --git a/src/Template/Element/claimbox.ctp b/src/Template/Element/claimbox.ctp index 76bc25e..f8a1dc3 100644 --- a/src/Template/Element/claimbox.ctp +++ b/src/Template/Element/claimbox.ctp @@ -4,7 +4,7 @@ $cost = ''; if (isset($claim->price) && $claim->price > 0) { $cost = $this->Amount->formatCurrency($claim->price) . ' LBC'; } else if (isset($claim->fee) && strtolower($claim->fee_currency) === 'lbc') { - $cost = $this->Amount->formatCurrency($claim->fee) . ' LBC'; + $cost = $this->Amount->formatLbryCurrency($claim->fee) . ' LBC'; } $a = ['purple', 'orange', 'blue', 'teal', 'green', 'yellow']; // content type diff --git a/src/Template/Main/claims.ctp b/src/Template/Main/claims.ctp index 7e21cd5..9de70d2 100644 --- a/src/Template/Main/claims.ctp +++ b/src/Template/Main/claims.ctp @@ -44,9 +44,9 @@ $cost = 'Free'; if (isset($claim->price) && $claim->price > 0) { $cost = $this->Amount->formatCurrency($claim->price) . ' LBC'; } else if (isset($claim->fee) && strtolower($claim->fee_currency) === 'lbc') { - $cost = (float) ($claim->fee) . ' LBC'; + $cost = $this->Amount->formatLbryCurrency($claim->fee) . ' LBC'; } -$effective_amount = $claim->effective_amount / 100000000; +$effective_amount = $this->Amount->formatLbryCurrency($claim->effective_amount); $desc = $claim->description; if (strlen(trim($desc)) == 0) { @@ -111,7 +111,7 @@ if (strlen(trim($desc)) == 0) {
Effective amount
claim_bid) . ' LBC'; ?>
-
claim_bid) ? 'Synchronizing' : ((float) ($claim->effective_amount / 100000000) . ' LBC'); ?>
+
effective_amount < $claim->claim_bid) ? 'Synchronizing' : ($effective_amount . ' LBC'); ?>
diff --git a/src/View/Helper/AmountHelper.php b/src/View/Helper/AmountHelper.php index e830421..75505b3 100644 --- a/src/View/Helper/AmountHelper.php +++ b/src/View/Helper/AmountHelper.php @@ -5,6 +5,8 @@ namespace App\View\Helper; use Cake\View\Helper; class AmountHelper extends Helper { + const DEWIES_DIVIDER = 100000000; + public function format($value, $thousandsSeparator = ',') { $value = number_format($value, 8, '.', $thousandsSeparator); $dotIdx = strpos($value, '.'); @@ -20,6 +22,10 @@ class AmountHelper extends Helper { return $value; } + + public function formatLbryCurrency($value, $thousandsSeparator = ",") { + return formatCurrency($value / DEWIES_DIVIDER); + } public function formatCurrency($value, $thousandsSeparator = ',') { $dotIdx = strpos($value, '.');