Renamed various fields from 'amount' to 'queryAmount' to prevent interfering with the getAmountAttribute property.

This commit is contained in:
James Cole
2015-04-09 21:14:15 +02:00
parent 0224d1d59b
commit 37f40d8637
5 changed files with 42 additions and 40 deletions

View File

@@ -103,14 +103,16 @@ class Steam
$id = intval($entry->id);
if (isset($array[$id])) {
$array[$id]['amount'] += floatval($entry->amount);
$array[$id]['queryAmount'] += floatval($entry->queryAmount);
$array[$id]['spent'] += floatval($entry->spent);
$array[$id]['encrypted'] = intval($entry->encrypted);
} else {
$array[$id] = [
'amount' => floatval($entry->amount),
'spent' => floatval($entry->spent),
'encrypted' => intval($entry->encrypted),
'name' => $entry->name
'amount' => floatval($entry->amount),
'queryAmount' => floatval($entry->queryAmount),
'spent' => floatval($entry->spent),
'encrypted' => intval($entry->encrypted),
'name' => $entry->name
];
}
}
@@ -131,7 +133,7 @@ class Steam
foreach ($two as $id => $value) {
// $otherId also exists in $one:
if (isset($one[$id])) {
$one[$id]['amount'] += $value['amount'];
$one[$id]['queryAmount'] += $value['queryAmount'];
$one[$id]['spent'] += $value['spent'];
} else {
$one[$id] = $value;
@@ -170,11 +172,11 @@ class Steam
{
uasort(
$array, function ($left, $right) {
if ($left['amount'] == $right['amount']) {
if ($left['queryAmount'] == $right['queryAmount']) {
return 0;
}
return ($left['amount'] < $right['amount']) ? 1 : -1;
return ($left['queryAmount'] < $right['queryAmount']) ? 1 : -1;
}
);
@@ -193,11 +195,11 @@ class Steam
{
uasort(
$array, function ($left, $right) {
if ($left['amount'] == $right['amount']) {
if ($left['queryAmount'] == $right['queryAmount']) {
return 0;
}
return ($left['amount'] < $right['amount']) ? -1 : 1;
return ($left['queryAmount'] < $right['queryAmount']) ? -1 : 1;
}
);