Commit Graph
54 Commits
Author SHA1 Message Date
Keith Solomon 64e320c6a5 index.php: add Balance After column header 2026-08-03 23:02:53 -05:00
Keith Solomon 5fe4bf9f58 buildTable: add Balance After column showing per-entry running_balance 2026-08-03 22:56:21 -05:00
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 257a848970 - Remove array sort function 2022-12-22 19:10:27 -06:00
Keith Solomon 57c62d1a3d Update readme 2022-12-21 07:48:03 -06:00
Keith Solomon eeb5f63885 - Add readme file
- Move vault transaction output to function
- Add list of all transactions from vault
- Start balance calculation functins
2022-12-21 07:46:21 -06:00
Keith Solomon 41807cf76a Update CSV files 2022-12-20 06:45:36 -06:00
Keith Solomon 119b2ee28c -Misc fixes
-Add all entries CSV
2022-12-17 18:17:37 -06:00
Keith Solomon 9fe9df26bd - Set up csv storage
- Sort CSV array by timestamp
- Build transaction table from CSV
2022-12-17 15:45:30 -06:00
Keith Solomon e8fe2957a5 - Split functions and styles from index
- Start building generic log retrieval function
2022-12-17 13:26:00 -06:00
Keith Solomon 8ef4e53b49 Merge pull request #2 from ksolomon/API-Connection
API connection
2022-09-27 09:53:05 -05:00
Keith Solomon 9864688aae Feat(api): Correct Log URL
Switch to correct API URL for the Log call

Issue/Task ID: 1
2022-09-27 09:50:21 -05:00
Keith Solomon 6e63f963b1 Feat(api): Change variable names
Changed $json in each API call to $jsonMoney and $jsonLog

Issue/Task ID: 1
2022-09-27 09:16:52 -05:00
Keith Solomon 3e8b919471 Feat(api): Connect to API
Set up and connect to both potential API sources.

Issue/Task ID: 1
2022-09-27 09:07:59 -05:00
Keith Solomon 6b6ca19b1c Docs(notes): Switch to plain text 2022-09-27 09:00:25 -05:00
Keith Solomon 2a3edacc63 Chore(*): Site notes 2022-09-27 08:39:54 -05:00
Keith Solomon c5876d6080 Chore(*): Initial commit 2022-09-27 08:06:45 -05:00
Keith Solomon 38973bbfc5 Initial commit 2022-09-27 08:03:34 -05:00