Added constants and new function for LBRY price display

This commit is contained in:
marcdeb1 2019-11-10 15:13:08 +01:00
parent ecaefa6950
commit 9764362855
2 changed files with 4 additions and 4 deletions

View file

@ -175,7 +175,7 @@ class MainController extends AppController {
}
if ($canConvert && $claim->fee > 0 && $claim->fee_currency == 'USD') {
$claim->price = $claim->fee / $priceInfo->price;
$claim->price = ($claim->fee / 100) / $priceInfo->price;
}
if (isset($claim->Stream)) {
@ -194,7 +194,7 @@ class MainController extends AppController {
$moreClaims = $this->Claims->find()->select($this->Claims)->select(['publisher' => 'C.name'])->leftJoin(['C' => 'claim'], ['C.claim_id = Claims.publisher_id'])->where(['Claims.claim_type' => 1, 'Claims.id <>' => $claim->id, 'Claims.publisher_id' => isset($claim->publisher) ? $claim->publisher_id : $claim->claim_id])->limit(9)->order(['Claims.fee' => 'DESC', 'RAND()' => 'DESC'])->toArray();
for ($i = 0; $i < count($moreClaims); $i++) {
if ($canConvert && $moreClaims[$i]->fee > 0 && $moreClaims[$i]->fee_currency == 'USD') {
$moreClaims[$i]->price = $moreClaims[$i]->fee / $priceInfo->price;
$moreClaims[$i]->price = ($moreClaims[$i]->fee / 100) / $priceInfo->price;
}
if (isset($moreClaims[$i]->Stream)) {

View file

@ -5,7 +5,7 @@ namespace App\View\Helper;
use Cake\View\Helper;
class AmountHelper extends Helper {
const DEWIES_DIVIDER = 100000000;
const DECIMAL_DIVIDER = 100000000;
public function format($value, $thousandsSeparator = ',') {
$value = number_format($value, 8, '.', $thousandsSeparator);
@ -24,7 +24,7 @@ class AmountHelper extends Helper {
}
public function formatLbryCurrency($value, $thousandsSeparator = ",") {
return formatCurrency($value / DEWIES_DIVIDER);
return $this->formatCurrency($value / AmountHelper::DECIMAL_DIVIDER);
}
public function formatCurrency($value, $thousandsSeparator = ',') {