Commit f3f20822 authored by Your Name's avatar Your Name

Expose settled winnings in report details

parent 3fdad329
......@@ -441,6 +441,7 @@ def bet_details(bet_id):
'amount': float(detail.amount),
'odds': float(odds),
'potential_winning': float(detail.amount) * float(odds),
'settled_winning': float(detail.win_amount or 0.0),
'result': detail.result,
'match': {
'match_number': match.match_number if match else 'Unknown',
......@@ -1105,6 +1106,7 @@ def cashier_bet_details(bet_id):
'amount': float(detail.amount),
'odds': float(odds),
'potential_winning': float(detail.amount) * float(odds),
'settled_winning': float(detail.win_amount or 0.0),
'result': detail.result,
'match': {
'match_number': match.match_number if match else 'Unknown',
......@@ -6559,6 +6561,7 @@ def get_cashier_bets():
'amount': float(detail.amount),
'odds': float(odds),
'potential_winning': float(detail.amount) * float(odds),
'settled_winning': float(detail.win_amount or 0.0),
'result': detail.result,
'match': {
'match_number': match.match_number if match else 'Unknown',
......@@ -8073,7 +8076,8 @@ def get_match_details():
'outcome': detail.outcome,
'amount': float(detail.amount),
'result': actual_result,
'potential_winning': potential_winning
'potential_winning': potential_winning,
'settled_winning': float(detail.win_amount or 0.0)
}
bets_data.append(bet_data)
......
......@@ -360,3 +360,21 @@ def test_match_details_route_uses_explicit_join_for_bet_lookup(monkeypatch, isol
assert response.status_code == 200
payload = response.get_json()
assert payload['total'] == 0
def test_match_details_includes_settled_winning_field(monkeypatch, isolated_api_blueprint):
install_route_test_doubles(monkeypatch)
detail = DummyDetail(match_id=10, amount=100.0, win_amount=250.0, result='win')
bet = DummyBet(uuid='bet1', bet_datetime=datetime(2026, 5, 1, 12, 0, 0))
match = DummyMatch(match_id=10)
match.status = 'done'
client = make_test_client(
DummySession([detail], [bet], [match]),
isolated_api_blueprint,
)
response = client.get('/api/reports/match-details?date=2026-05-01&match_id=10')
assert response.status_code == 200
payload = response.get_json()
assert payload['total'] == 0
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