vaultLoop: prefer live /money balance, fall back to MAX(running_balance)
This commit is contained in:
@@ -205,6 +205,16 @@ function fetchVaultRecords($user = null) {
|
|||||||
* @return int The total balance of the given user (or all users if no user is given).
|
* @return int The total balance of the given user (or all users if no user is given).
|
||||||
*/
|
*/
|
||||||
function vaultLoop ($name=null) {
|
function vaultLoop ($name=null) {
|
||||||
|
$liveBalance = $name === null
|
||||||
|
? null
|
||||||
|
: fetchLiveVaultBalance($name);
|
||||||
|
|
||||||
|
if ($liveBalance !== null) {
|
||||||
|
return $liveBalance;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback: derive from stored entries. Used when the live /money call
|
||||||
|
// fails or is not configured for the user.
|
||||||
$pdo = getDatabaseConnection();
|
$pdo = getDatabaseConnection();
|
||||||
|
|
||||||
if ($name === null) {
|
if ($name === null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user