Skip to content

TebBet: activity log, hidden odds for kept-out members, free scratch cards and market cleanup - #18

Merged
andersgar merged 7 commits into
mainfrom
fixes
Oct 7, 2026
Merged

andersgar merged 7 commits into
mainfrom
fixes

Conversation

@andersgar

Copy link
Copy Markdown
Contributor

What

  • Activity log: GET /bet/activity lists every slip played, every market decided or called off and every scratch card scratched to the end, newest first. Older pages with ?before=, one kind with ?kind=slip|result|ticket. Each result lists everyone who played on it: their pick, odds, whether it came true and what the slip won or lost all told. Combinations say how many picks they have and how many of their markets were called off.
  • Hidden odds: a member kept out of a market no longer gets its odds or how the coins are spread. That holds on the market, in the latest bets, on member pages and in the activity log. Their own slips keep theirs.
  • Free scratch cards: POST /bet/flaks/:game/try draws a ticket by the real odds and returns every field. Nothing is stored, taken or paid.
  • Live stakes only: "Du har 100 på …" counted slips already lost, such as a combination lost on another market. Now only open slips count.
  • Unplayed markets removed: a market nobody played on is deleted a day after it closes. This runs at start-up and every ten minutes, but not in trial runs.

Testing

  • npm run typecheck and npm test (20 tests). New tests cover the activity log, a lost combination's stake, hidden odds and free tickets.
  • Checked by hand against the mock servers with eight combination cases: lost on another market, waiting on the rest, won, and a called-off market.

Deploy

Merging deploys it. The site PR (TEBONSMA/tebbet, fixes) uses the new endpoints, so merge this one first.

Runs at start-up and every ten minutes. Until the day has passed, the
organizer can still give a market a new closing time.
GET /bet/activity lists every slip played, every market decided or
called off and every scratch card scratched to the end, the newest
first, a page at a time and optionally one kind only.
They still see the market, but not its odds or how the coins on it are
spread, and the latest bets, member pages and the activity log leave
out the odds of bets on it too. A member's own slips keep theirs.
POST /bet/flaks/:game/try draws a ticket by the same odds as a real one
and returns every field at once. Nothing is kept, no coins are taken and
no prize is paid.
Each decided market comes with every slip that had a pick on it: the
pick, its odds, whether it came true and what the slip won or lost all
told, winners first. A member kept out of the market sees neither the
odds nor what a winner got.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Unresolved moderate hidden-odds and activity-pagination issues remain.

Review effort: Lite
Findings: 4 Medium severity

Open (4)
What changed in this PR

Adds activity history, hidden-odds handling, free scratch-card trials, live-stake accounting, and automatic cleanup of unplayed markets.

Changes:

  • Adds filtered, paginated activity and scratch-card endpoints.
  • Masks excluded-market odds, distributions, totals, and payouts.
  • Counts only open slips and schedules unplayed-market cleanup.
File Review summary
test/​api.test.ts Covers the new activity, hidden-odds, free-ticket, and stake behaviors.
src/​server.ts Adds scheduled market cleanup.
src/​flaks.ts Generates free scratch-card trials.
src/​bets.ts Moderate issues: owner odds exception is missing; hidden-market aggregates and payouts remain exposed.
src/​betRoutes.ts Adds activity and scratch-card routes.
src/​activity.ts Moderate issues: timestamp cursor ties can skip entries; own historical odds are hidden; hidden combination totals can leak odds; exact-page pagination returns a phantom next; timestamp-only ordering can split slips.
README.md Documents the updated API and behavior.
dev/​demo.ts Updates demo handling for hidden odds.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/activity.ts
Comment thread src/activity.ts
Comment thread src/bets.ts
Comment thread src/bets.ts
@andersgar
andersgar merged commit e00c377 into main Oct 7, 2026
2 checks passed
@andersgar
andersgar deleted the fixes branch October 7, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants