Compare commits
1
Commits
bd120608d7
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4339958b5e |
@@ -248,10 +248,10 @@ git commit -m "fetchVaultRecords: explicit column list including running_balance
|
||||
|
||||
---
|
||||
|
||||
### Task 4: Switch `vaultLoop` / `generateBalance` / `getSpace` to MAX(running_balance)
|
||||
### Task 4: Switch `vaultLoop` to MAX(running_balance)
|
||||
|
||||
**Files:**
|
||||
- Modify: `functions.php` (the three functions)
|
||||
- Modify: `includes/utilities.php` (`vaultLoop` lives there; `generateBalance` and `getSpace` already wrap it via `functions.php` — they don't need changes)
|
||||
|
||||
**Interfaces:**
|
||||
- `vaultLoop($name=null)`: returns the per-user vault balance (the most recent entry's `running_balance`) for the given user, or the sum of those across all users when `$name` is null. Goes directly to PDO instead of fetching records.
|
||||
@@ -260,7 +260,7 @@ git commit -m "fetchVaultRecords: explicit column list including running_balance
|
||||
|
||||
- [ ] **Step 1: Replace `vaultLoop` with a SQL-based implementation**
|
||||
|
||||
In `functions.php`, replace `vaultLoop` (currently at lines 199-208) with:
|
||||
In `includes/utilities.php`, replace `vaultLoop` (currently at lines 202-208) with:
|
||||
|
||||
```php
|
||||
function vaultLoop ($name=null) {
|
||||
@@ -285,13 +285,13 @@ function vaultLoop ($name=null) {
|
||||
|
||||
- [ ] **Step 2: Verify the file parses**
|
||||
|
||||
Run: `php -l functions.php`
|
||||
Run: `php -l includes/utilities.php`
|
||||
Expected: `No syntax errors detected`.
|
||||
|
||||
- [ ] **Step 3: Commit**
|
||||
|
||||
```bash
|
||||
git add functions.php
|
||||
git add includes/utilities.php
|
||||
git commit -m "vaultLoop: use MAX(running_balance) per user instead of SUM(amount)"
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user