Commit Graph
71 Commits
Author SHA1 Message Date
Keith Solomon f1cd0d53b1 Invoke backfillRunningBalances after sync/backfill 2026-08-03 22:47:40 -05:00
Keith Solomon a81554a125 Add backfillRunningBalances helper for NULL running_balance rows 2026-08-03 22:41:22 -05:00
Keith Solomon a9e443eeb2 vaultLoop: use MAX(running_balance) per user instead of SUM(amount) 2026-08-03 22:17:11 -05:00
Keith Solomon 214891d957 fetchVaultRecords: explicit column list including running_balance 2026-08-03 22:00:56 -05:00
Keith Solomon af7a233272 Capture running_balance from v2 API data.balance 2026-08-03 21:54:40 -05:00
Keith Solomon 2e1bd050e1 Schema: add running_balance column to vault table 2026-08-03 21:47:46 -05:00
Keith Solomon 908e2c50ab Add plan: vault balance from per-entry API value
- 9 tasks: schema migration, capture data.balance, fetchVaultRecords
  column list, vaultLoop switch to MAX, backfill helper, wire backfill,
  buildTable column, index.php header, end-to-end smoke check
- TDD: failing test in Task 2 before rewriting processLogEntries
- Idempotent schema migration via PRAGMA table_info check
- One-shot live-read backfill broadcasts latest balance to NULL rows
2026-08-03 21:41:33 -05:00
Keith Solomon a133a5a49d index.php: catch bootstrap exceptions and render a non-fatal warning
Per the spec's error-handling section, all exceptions must be caught at
the top of index.php's bootstrap path so a single bad page (CurlError,
JsonData, ApiValidation, ApiKeyMissing, LogEntryIncomplete) does not take
down the whole UI. The page now renders whatever data is in the DB plus
a warning banner with the exception message (htmlspecialchars-escaped to
avoid XSS). On the first-run backfill path, the redirect is still
emitted inside the try block so the success path is unchanged.
2026-08-03 14:18:48 -05:00
Keith Solomon 73360f6805 processLogEntries: skip incomplete entries instead of throwing
Per the spec's error-handling table, entries missing timestamp or
details.title should be skipped (logged via consoleLog) and the loop
should continue processing the rest. Previously the function threw
LogEntryIncompleteException and aborted the entire batch, which would
take down the whole UI when a single malformed entry was returned.
2026-08-03 14:17:27 -05:00
Keith Solomon 89ecaaa6c7 Remove dead prepareCheckStatement/prepareInsertStatement helpers
These helpers were no longer called after the v2 migration rewrote
processLogEntries and fetchAndStoreLogPage (the latter now prepares its
own idempotent INSERT inline). Rendered unused by the v2 migration.
2026-08-03 14:16:16 -05:00
Keith Solomon 9fa5247445 Style fixes from phpcs 2026-08-03 13:54:30 -05:00
Keith Solomon 265e1841f0 Update index.php to call backfillUserLogs/syncUserLogs 2026-08-03 13:45:37 -05:00
Keith Solomon d6aef3da42 Replace firstRun/getLog with backfillUserLogs/syncUserLogs 2026-08-03 13:40:12 -05:00
Keith Solomon cb584e9d3a Restore consoleLog helper and remove test stub masking production fatal
The v2 rewrite of processLogEntries() calls consoleLog(...) at two
skip branches (no id, and no deposited/withdrawn). Commit 3ebc5e2 had
removed the project helper from includes/utilities.php, leaving a
production runtime fatal ("Call to undefined function consoleLog()")
the first time a non-vault entry flowed through fetchAndStoreLogPage
-> processLogEntries in real use.

The previous test appeared to pass only because it defined a local
no-op consoleLog stub via function_exists() guard — masking the defect
behind a test fixture that never reached either skip branch.

Fix:
  - Restore the original consoleLog() helper to
    includes/utilities.php (unchanged from the pre-3ebc5e2 codebase;
    spec lists it as unchanged).
  - Remove the local consoleLog stub from
    tests/process_log_entries_test.php so the test now exercises
    the real production code path.
2026-08-03 13:34:29 -05:00
Keith Solomon 2a55cc11ee Rewrite processLogEntries for v2 shape; add golden-file test 2026-08-03 13:27:43 -05:00
Keith Solomon 9a4a7291cc Add fetchAndStoreLogPage helper for v2 pagination 2026-08-03 13:19:38 -05:00
Keith Solomon 07a8bba1d5 Tighten validateApiResponse for v2 array shape 2026-08-03 13:13:50 -05:00
Keith Solomon 3ebc5e2850 Remove unauthorized consoleLog helper and restore original quote style 2026-08-03 13:06:30 -05:00
Keith Solomon e25a069e00 Rewrite executeApiCall for v2 API (Authorization header) 2026-08-03 13:01:52 -05:00
Keith Solomon 93b934c5cc Add LogEntryIncompleteException for malformed v2 entries 2026-08-03 12:56:32 -05:00
Keith Solomon e7ec343be1 Add implementation plan: Torn API v1 to v2 migration
- 8 tasks: exception class, API call rewrite, validation tightening,
  fetchAndStoreLogPage helper, processLogEntries rewrite with golden-file
  test, backfillUserLogs/syncUserLogs entry points, index.php call swap,
  end-to-end smoke check
- TDD: write the failing test before rewriting processLogEntries
- Each task is a self-contained commit
2026-08-03 12:47:59 -05:00
Keith Solomon c2b138d687 Add spec: Torn API v1 to v2 migration design
- Compares old (api-sample.json) and new (api-sample-new.json) shapes
- Specifies Authorization: ApiKey header instead of ?key= query param
- Specifies following _metadata.links.next for pagination
- Specifies entry.id (string) as PRIMARY KEY with INSERT ... ON CONFLICT DO NOTHING
- Adds backfillUserLogs (replaces firstRun) and syncUserLogs (renamed from getLog)
- Adds shared fetchAndStoreLogPage helper
- Adds golden-file unit test (no live API)
2026-08-03 12:42:19 -05:00
Keith Solomon 2811fc83e5 Enhance Torn Vault Tracker: Add documentation, improve exception handling, and update styles
Deploy website via FTP / Deploy (push) Skipped
- Updated .gitignore to exclude new directories and files.
- Enhanced config.php with detailed PHPDoc comments for better clarity.
- Refactored functions.php to include PHPDoc comments and improve code readability.
- Added custom exceptions in exceptions.php with detailed documentation.
- Improved utilities.php with better documentation and error handling.
- Updated index.php with structured comments and improved readability.
- Refined style.css for better visual consistency.
- Introduced phpcs.xml for coding style checks and standards enforcement.
2026-08-03 12:07:16 -05:00
Keith Solomon 8c68e81c2e Refactor FTP deployment workflow by removing emojis and updating conditions for deployment trigger
Deploy website via FTP / Deploy (push) Skipped
2026-08-03 11:32:38 -05:00
Keith Solomon 7f1f4de553 Enhance README and refactor code structure for improved functionality
🚀 Deploy website via FTP / 🎉 Deploy (push) Failing after 8s
- Updated README.md with detailed project description, features, and installation instructions.
- Refactored functions.php to include configuration settings and improved database handling.
- Modified index.php for better user experience and added pagination controls.
- Introduced new utility functions for API handling and database interactions.
- Added CSS styles for improved layout and visibility of elements.
- Removed vault.csv as data is now managed through the database.
- Implemented FTP deployment workflow for automated deployment.
- Added exception handling classes for better error management.
- Created JavaScript functions for pagination of transaction records.
2026-08-03 11:26:55 -05:00
Keith Solomon 6e63c37071 - Update README 2022-12-31 13:24:10 -06:00
Keith Solomon b13d9294da - Update vault.csv with default values
- Update README with vault info
2022-12-31 13:22:37 -06:00
Keith Solomon 28eecb304a - Update functions.php 2022-12-31 12:57:25 -06:00
Keith Solomon 31435f5520 - Update functions.php 2022-12-31 12:51:07 -06:00
Keith Solomon 85e5724c23 - Update functions.php for generic user names/keys
- Update README
2022-12-31 12:16:38 -06:00
Keith Solomon 66f1da90e4 - Add Torn profile link to README 2022-12-31 11:55:15 -06:00
Keith Solomon ce8cea41b9 - Add Torn profile link to README 2022-12-31 11:54:08 -06:00
Keith Solomon 6c24b59894 Add Torn profile link to README 2022-12-31 11:51:19 -06:00
Keith Solomon d7dfcdf3f9 Remove old project files 2022-12-31 11:48:07 -06:00
Keith Solomon e9a92be0c6 Git fix 2022-12-31 11:44:09 -06:00
Keith Solomon 887d758196 - Move to public repo
- Remove CSV values
- Readme typo fix
2022-12-31 11:37:08 -06:00
Keith Solomon c63adb7f93 - Move to public repo
- Remove CSV values
- Readme typo fix
2022-12-31 11:36:53 -06:00
Keith Solomon d86b718c65 - Update styles
- Reverse CSV array for transactions log
2022-12-23 19:21:30 +00:00
Keith Solomon 521644d997 Feature complete 2022-12-23 18:08:43 +00:00
Keith Solomon 28a923fcd7 - Display overall vault balance
- Add Roboto google font
2022-12-23 17:53:44 +00:00
Keith Solomon fb443e38b6 - Set up vault balance function
- Add comments for functions
2022-12-23 17:38:35 +00:00
Keith Solomon d414e6d83a Move vaultBalances to userBalances 2022-12-23 17:35:18 +00:00
Keith Solomon c3149ea2ab Move balance function to generic 2022-12-23 17:33:29 +00:00
Keith Solomon 388266609d - Adjust styles
- Adjust alignment
2022-12-23 17:30:53 +00:00
Keith Solomon abe10c88a2 Add variables for user name in balance function 2022-12-23 16:53:08 +00:00
Keith Solomon 828f13f975 - Move user balances to function
- Build overall vault balnce section
2022-12-23 16:50:24 +00:00
Keith Solomon 603fcd9bdd - Set up user balance calculations
- Display balances on page
2022-12-23 16:36:54 +00:00
Keith Solomon 43412ee0dc Correct date for initial balance 2022-12-23 09:58:10 -06:00
Keith Solomon 83727e2055 Remove old vault.csv 2022-12-23 09:55:49 -06:00
Keith Solomon b15cd81b10 Fix git issues 2022-12-23 09:53:21 -06:00