Commit 27b5028b authored by Your Name's avatar Your Name

Use settled win amounts in bet details

parent 6a7a0542
......@@ -461,7 +461,7 @@ def bet_details(bet_id):
has_pending = True
elif is_settled_bet_detail_winning(detail, match, session):
results['won'] += 1
results['winnings'] += float(detail.amount) * float(odds) # Use actual odds
results['winnings'] += float(detail.win_amount or 0.0)
elif detail.result == 'lost':
results['lost'] += 1
elif detail.result == 'cancelled':
......
......@@ -275,6 +275,16 @@ def test_settled_winning_check_prefers_explicit_lost_for_completed_match():
assert is_settled_bet_detail_winning(detail, match, session) is False
def test_settled_winning_check_uses_win_amount_for_completed_match_display():
detail = DummyDetail(match_id=10, amount=100.0, win_amount=250.0, result='win')
match = DummyMatch(match_id=10)
match.status = 'done'
session = Mock()
assert is_settled_bet_detail_winning(detail, match, session) is True
assert float(detail.win_amount) == 250.0
def test_match_reports_route_counts_winning_payout_after_loading_match(monkeypatch, isolated_api_blueprint):
install_route_test_doubles(monkeypatch)
match = DummyMatch(match_id=10)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment