vaultLoop: prefer live /money balance, fall back to MAX(running_balance)

This commit is contained in:
Keith Solomon
2026-08-05 10:04:43 -05:00
parent 728f7bb4a5
commit 006520b4c0
+10
View File
@@ -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).
*/
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();
if ($name === null) {