Commit Graph

70 Commits

Author SHA1 Message Date
Samuel Enocsson 7fb8cab5e2 feat: add 'View calculation details' link to expanded row (#4) 2026-05-21 15:16:51 +02:00
Samuel Enocsson 7af9d8d69e fix: null-safe icon selectors after table restructure (#4) 2026-05-21 15:16:09 +02:00
Samuel Enocsson 16d375ae10 refactor: design-fidelity pass on players page 2026-05-21 15:15:29 +02:00
Samuel Enocsson 686d7ca00c fix: use template-literal interpolation for KPI strip inside body string (#5)
The page body is assembled as a JS template literal inside <% ... %>;
EJS tags inside that string break the EJS parser (it sees the first %>
as the close of the outer tag). Switch to ${kpis.x} interpolation since
we're already inside a backtick string.
2026-05-21 15:03:02 +02:00
Samuel Enocsson ac6008aa14 chore: delete dead progress.js (#4) 2026-05-21 14:38:06 +02:00
Samuel Enocsson cc223a4b8a fix: drop unused html field from renderDeltaPill (#3) 2026-05-21 14:38:06 +02:00
Samuel Enocsson 0ded27f9df fix: address code review findings — DRY delta-pill, var→const/let, tokenize colors 2026-05-21 14:38:06 +02:00
Samuel Enocsson 9df151f109 fix: return latest N months in getMonthlyHistory (#6) 2026-05-21 14:38:06 +02:00
Samuel Enocsson b75e60da65 feat: redesign expanded row with detail-grid + history chart (#7) 2026-05-21 14:38:06 +02:00
Samuel Enocsson e5f16e624e feat: pass player record into player-history partial render (#7) 2026-05-21 14:38:06 +02:00
Samuel Enocsson 83ceaf0ea3 feat: add KPI summary tiles above players table (#5) 2026-05-21 14:38:06 +02:00
Samuel Enocsson b51ae19ae1 feat: render sparklines + wire trend-chart pill toggle (#6) 2026-05-21 14:37:58 +02:00
Samuel Enocsson 6129b6fd3b feat: wire computeKpis into the page render (#5) 2026-05-21 14:37:48 +02:00
Samuel Enocsson 3dcd3131a0 feat: add monthlyHistory[] per player via getMonthlyHistory + bulk fetch (#6)
Add getMonthlyHistory() to models/player for single-player use and
getAllMonthlyHistoriesFromDB() for bulk fetches (one query, grouped in
memory). Wire monthlyHistory into all player objects returned by
getPlayerDataFromDB and getAllRatingsFromDB. Bulk path pre-fetches in
one query to avoid N extra per-player queries.
2026-05-21 13:41:20 +02:00
Samuel Enocsson 19756b80e5 feat: expose lastMonthRating and deltaPredicted on player objects (#3)
Add two derived fields to all player objects returned by
getPlayerDataFromDB and the error branch in getAllRatingsFromDB.
No new DB columns — both fields are pure arithmetic derivations.
monthlyHistory placeholder [] included ahead of A2 implementation.
2026-05-21 13:38:04 +02:00
Samuel Enocsson 3f7a1bb7bf chore: remove dead code orphaned by topbar redesign (#4)
The new topbar's "Refresh all" button replaces the old SSE-driven
"Load All" link and progress UI. With those gone, several pieces of
infrastructure had no callers left:

- GET /api/load-all-players, POST /api/populate-database, and
  GET /api/database-status — SSE endpoints with no frontend consumers
- #progress-section / #loading divs in players + courses pages
- .progress-container / .progress-bar / .progress-text / .loading CSS
- public/js/progress.js script (defines fetchRatingsWithProgress, never
  called, and loadAllPlayers, no longer wired) — to be deleted manually
  since the sandbox blocks rm
2026-05-21 13:15:53 +02:00
Samuel Enocsson 53bc6e571d chore: remove redundant "Load All" link from players page (#4)
The topbar's "Refresh all" button (introduced in #4) supersedes this
link. Leaving the gear icon for clearCache() — that's a separate
concern.
2026-05-21 13:11:28 +02:00
Samuel Enocsson de99d4ede7 fix: address code review for visual layer + topbar (#4) 2026-05-21 12:50:31 +02:00
Samuel Enocsson 8c977d6624 feat: shared visual layer + redesigned topbar (#4)
Introduce new design token set (paper/ink/line/accent + radius/shadow)
with backward-compat aliases for legacy --surface/--navy/--text names.
Swap DM Sans for Plus Jakarta Sans, add JetBrains Mono with tabular
numerics. Replace .app-header with sticky .topbar partial (brand +
segmented nav + Next update / Last refresh meta + Refresh all button).

Add POST /api/refresh-all that runs refreshAllPlayersInDB() with an
in-memory mutex and returns the rendered topbar so HTMX can swap it
in. "Next update" is computed as first Tuesday of next month
(approximation of PDGA's monthly cycle). "Last refresh" derives
from MAX(players.last_updated).
2026-05-21 12:37:31 +02:00
Samuel Enocsson 6e05d3014d refactor: remove tour feature and Tjing import
Release Please / release-please (push) Waiting to run
Release Please / docker (push) Blocked by required conditions
Tour functionality has moved to its own project (HyzrTour).
Removes all tour-related code, Tjing integration, and associated
views/styles/scripts. Keeps the saveCourseToDB ON CONFLICT fix.
2026-03-20 15:05:20 +01:00
shcizo b4206d9865 Merge pull request #7 from shcizo/release-please--branches--main--components--pdga-ratings
chore(main): release 1.2.0
2026-03-20 08:46:15 +01:00
github-actions[bot] 4a96d73fb9 chore(main): release 1.2.0 2026-03-20 07:45:38 +00:00
Samuel Enocsson eb77b1f32b feat: add Tjing course import
Search and import courses with layouts from Tjing's GraphQL API.
Total par is calculated from individual hole data. Courses are saved
with a tjing.se link as unique identifier to prevent duplicates.
2026-03-20 08:45:16 +01:00
shcizo 808619a04b Merge pull request #6 from shcizo/release-please--branches--main--components--pdga-ratings
chore(main): release 1.1.1
2026-03-20 08:11:44 +01:00
github-actions[bot] 86ca11c97e chore(main): release 1.1.1 2026-03-20 07:11:16 +00:00
Samuel Enocsson 619567b550 fix: prevent course ID changes on re-scrape and add layout repair script
saveCourseToDB now uses ON CONFLICT DO UPDATE instead of INSERT OR REPLACE,
which preserves the course ID and prevents orphaning of layout foreign keys.

Added scripts/repair-layouts.js to reassign orphaned layouts to their
correct courses by detecting the ID offset from re-scraping.
2026-03-20 08:11:01 +01:00
shcizo 59ee1f0b99 Merge pull request #4 from shcizo/release-please--branches--main--components--pdga-ratings
chore(main): release 1.1.0
2026-03-20 07:54:28 +01:00
github-actions[bot] e9a3c7f35e chore(main): release 1.1.0 2026-03-20 06:41:17 +00:00
shcizo 0c052dc7dd Merge pull request #5 from shcizo/feat/async-tours
feat: async tour system
2026-03-20 07:40:59 +01:00
Samuel Enocsson d7f7bed8c6 fix: use fixed point scale for tour scoring
1st=10, 2nd=8, 3rd=6, 4th=4, 5th=3, 6th=2, 7th=1, rest=0.
Ties get same points, next rank skips (1,1,3 pattern).
2026-03-20 07:39:43 +01:00
Samuel Enocsson bdb8bca526 fix: base tour points on total enrolled players, not submitted results
1st place now gets N points where N is total tour participants,
not just those who submitted for that specific course. This makes
the leaderboard meaningful even when not everyone has played yet.
2026-03-20 07:39:43 +01:00
Samuel Enocsson 80616f6523 fix: use localStorage instead of sessionStorage for tour membership
Persists across browser sessions so players don't need to rejoin.
2026-03-20 07:39:43 +01:00
Samuel Enocsson a6250eb76a fix: move custom layout fields to own row in tour creation form 2026-03-20 07:39:43 +01:00
Samuel Enocsson 38cc93bc1c feat: allow custom layouts when creating tours
Courses without scraped layouts can now be used in tours by entering
a layout name and par manually. The layout is saved to the database
for reuse. All courses are shown in the dropdown, not just those with
existing layouts.
2026-03-20 07:39:43 +01:00
Samuel Enocsson 2ccb018bdf feat: add async tour system
Players can create tours with selected courses/layouts and a date range.
Others join via a 6-character tour code, play the courses, and report
their total strokes. Live leaderboard with points and +/- par display.

Includes: database schema, model, service, routes, views, and styling.
2026-03-20 07:39:43 +01:00
Samuel Enocsson d567c4bca9 fix: upgrade Node 18 to 22 and fix Puppeteer compatibility
- Switch from Alpine to Debian slim for correct Chromium architecture
  (fixes ARM/Apple Silicon support)
- Upgrade Puppeteer 21 to 24, use system Chromium via PUPPETEER_EXECUTABLE_PATH
- Replace removed page.waitForTimeout() with setTimeout
- Set NODE_ENV=production in Dockerfile to prevent pino-pretty import
- Improve error logging with Pino's { err: error } pattern
- Add build: . to docker-compose for local development builds
2026-03-20 07:39:34 +01:00
shcizo 0b55aeb632 Merge pull request #3 from shcizo/release-please--branches--main--components--pdga-ratings
chore(main): release 1.0.0
2026-02-21 16:07:04 +01:00
github-actions[bot] 4ac26dfb94 chore(main): release 1.0.0 2026-02-21 15:06:19 +00:00
Samuel Enocsson 9bc71c7a37 chore: Re-trigger release-please 2026-02-21 16:05:57 +01:00
Samuel Enocsson 1163337163 chore: Trigger release-please after enabling PR permissions 2026-02-21 16:03:43 +01:00
Samuel Enocsson c7ecd231ff chore: Remove deprecated version key from docker-compose 2026-02-21 16:00:50 +01:00
Samuel Enocsson f0e68091c2 fix: Point docker-compose to GHCR image instead of local build 2026-02-21 16:00:31 +01:00
Samuel Enocsson 78cb2dc211 chore: Add CLAUDE.md project documentation 2026-02-21 15:57:48 +01:00
Samuel Enocsson 6ac32457a9 feat: Add Pino structured logging, release-please CI/CD and Docker pipeline
Replace all console.log/error with Pino logger (info/warn/error/debug/fatal)
for structured JSON logging in production and pretty-print in development.
Remove redundant header dumps and consolidate rate-limit logging.

Add GitHub Actions workflow with release-please for automated semver releases
and Docker build/push to GHCR on new releases.
2026-02-21 15:56:57 +01:00
Samuel Enocsson 371a398446 Modernize UI design with new color system, typography and layout
- Add sticky dark header with nav replacing inline text links
- Introduce CSS custom properties design system (colors, spacing, shadows)
- Use DM Sans + JetBrains Mono fonts replacing Arial
- Modernize tables with uppercase headers and subtle hover states
- Add gradient fill and rounded line to rating chart
- Unify card sections across players and courses pages
- Add backdrop blur to modals
- Clean up inline styles to use CSS variables
2026-02-19 09:12:04 +01:00
shcizo 2f73dddbd8 Merge pull request #2 from shcizo/refactor/modularize-htmx
Refactor: modularize server.js, add EJS/HTMX, stealth scraping
2026-02-19 09:01:13 +01:00
Samuel Enocsson bd33ac2901 Add puppeteer-extra stealth plugin to avoid headless browser detection
PDGA was blocking headless Chrome requests with ECONNRESET errors.
Using puppeteer-extra-plugin-stealth to mask headless browser
fingerprints (navigator.webdriver, chrome.runtime, plugins, etc).
2026-02-19 09:00:08 +01:00
Samuel Enocsson 7e5fa6cbf1 Add HTMX migration for server-rendered tables and lazy loading
- Add HTMX CDN to layout
- Replace client-side table rendering (displayRatings, displayCourses)
  with server-rendered EJS partials via hx-get
- Add server-side course search with debounced hx-trigger
- Lazy-load player history and course layouts via htmx.ajax()
- Render rating chart via htmx:afterSwap with data attributes
- Add partial routes: ratings-table, course-table, player-history,
  course-layouts
2026-02-19 08:29:56 +01:00
Samuel Enocsson 20bbdbbfcf Extract inline CSS/JS, add EJS templates with shared layout
- Extract CSS into public/css/{shared,players,courses}.css
- Extract JS into public/js/{chart,tooltips,progress,players,courses}.js
- Consolidate 5 duplicated tooltip blocks into setupTooltip() helper
- Add EJS view engine with layout partial and nav partial
- Convert HTML pages to EJS templates (index.ejs, courses.ejs)
- Add /courses route with redirect from /courses.html
- Remove old monolithic HTML files (1478 + 612 lines)
2026-02-18 22:32:03 +01:00
Samuel Enocsson 33a962e6b8 Refactor: split server.js monolith into modular architecture
Extract 3410-line server.js into 12 focused modules:
- src/db.js: database init and migrations
- src/models/{player,course}.js: DB helper functions
- src/scrapers/{browser,player-http,player-puppeteer,course-puppeteer}.js
- src/services/{player-service,rating-calculator}.js
- src/routes/{players,courses,pages}.js

Remove dead code: duplicate saveRatingHistoryToDB, legacy
getPlayerCompetitionRatings/getPredictedRating/getAllRatingsWithScraping,
unused getCourseFromDB/getLatestOfficialRoundDate/testPDGARateLimit,
legacy cache Map, and POST /api/predicted-rating route.

Consolidate 5 duplicated Puppeteer launch blocks into launchBrowser().
server.js is now 28 lines: imports, middleware, mount routers, bootstrap.
2026-02-18 22:20:58 +01:00