mirror of
https://repo.getmonero.org/AnonDev/xmrmemes.git
synced 2024-10-01 05:25:34 -04:00
Fix amounts from showing scientific notation
Very small amounts were showing scientific notation numbers when dispaying the total amount of tips on a meme or user or on the leaderboard. This should fix that. There may be a cleaner way to do this but this gets the job done.
This commit is contained in:
parent
9cfea79309
commit
c5141e10e0
@ -42,7 +42,13 @@ class Meme extends Model
|
||||
|
||||
public function getMemeTipsTotalAttribute()
|
||||
{
|
||||
return $this->tips->where('is_deposit', 1)->sum('amount_formatted');
|
||||
if ($this->tips->where('is_deposit', 1)->sum('amount_formatted')) {
|
||||
return rtrim(sprintf('%.8f',floatval(
|
||||
$this->tips->where('is_deposit', 1)->sum('amount_formatted')
|
||||
)),'0');
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public function getImageUrlAttribute()
|
||||
|
@ -66,7 +66,13 @@ class User extends Authenticatable
|
||||
|
||||
public function getTipsTotalAttribute()
|
||||
{
|
||||
return $this->tips->where('is_deposit', 1)->sum('amount_formatted');
|
||||
if ($this->tips->where('is_deposit', 1)->sum('amount_formatted')) {
|
||||
return rtrim(sprintf('%.8f',floatval(
|
||||
$this->tips->where('is_deposit', 1)->sum('amount_formatted')
|
||||
)),'0');
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user