Simplify commission handling and update tests#72
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| rounding = table.settings.get("commission_rounding", "none") | ||
| floor = float(table.settings.get("commission_floor", 0.0) or 0.0) | ||
|
|
||
| if bet_amount < floor: | ||
| base = 0.0 | ||
| else: | ||
| if mode == "on_bet": | ||
| base = bet_amount | ||
| else: | ||
| base = gross_win | ||
| # Commission parity: regardless of timing (``on_bet`` vs ``on_win``), the |
There was a problem hiding this comment.
commission_mode no longer affects fee calculation
The refactor reads commission_mode but then unconditionally computes the fee as bet_amount * 0.05, explicitly discarding gross_win. As a result, the configuration toggle that previously chose between charging 5% of the wager ("on_bet") or 5% of the gross win ("on_win") no longer changes the fee amount—both settings now cost 5% of the bet regardless of the mode. This contradicts the README’s documented behavior for commission_mode="on_win" (fee on the win amount) and will misprice commissions for lay bets where the win is smaller than the stake. Either reintroduce the mode-sensitive base calculation or remove/deprecate the setting so callers are not misled.
Useful? React with 👍 / 👎.
Summary
_compute_commissionalways charges a fixed 5% of the wager with rounding/floor policies applied uniformly; on_bet/on_win now differ only in timingTesting
https://chatgpt.com/codex/tasks/task_e_690c93d9ebfc8328a3fb73a1bacd0944