Commit 513abac6 authored by Your Name's avatar Your Name

Fix: CAP recovery mode for negative balance (v1.0.20)

- Added recovery mode detection when accumulated_shortfall < 0
- When in recovery mode, select only results with minimum payout to redistribute less
- Updated version to 1.0.20 and 1.0r20
parent ba5481a0
......@@ -217,7 +217,7 @@ Examples:
parser.add_argument(
'--version',
action='version',
version='MbetterClient 1.0.19'
version='MbetterClient 1.0.20'
)
# Timer options
......
......@@ -4,7 +4,7 @@ MbetterClient - Cross-platform multimedia client application
A multi-threaded application with video playback, web dashboard, and REST API integration.
"""
__version__ = "1.0.19"
__version__ = "1.0.20"
__author__ = "MBetter Project"
__email__ = "dev@mbetter.net"
__description__ = "Cross-platform multimedia client with video overlay and web dashboard"
......
......@@ -262,7 +262,7 @@ class ApiConfig:
# Request settings
verify_ssl: bool = True
user_agent: str = "MbetterClient/1.0r19"
user_agent: str = "MbetterClient/1.0r20"
max_response_size_mb: int = 100
# Additional API client settings
......
......@@ -3649,6 +3649,12 @@ class GamesThread(ThreadedComponent):
# Adjust CAP threshold based on UNDER/OVER result
cap_threshold = base_cap_threshold + accumulated_shortfall
# CRITICAL FIX: Check if we have negative cap balance (over-redistribution)
# If accumulated_shortfall is negative, we need to RECOVER by redistributing less
is_recovery_mode = accumulated_shortfall < 0
if is_recovery_mode:
logger.info(f"🎯 [RECOVERY MODE] Negative cap balance detected: {accumulated_shortfall:.2f} - Will redistribute minimum possible to recover")
# If UNDER/OVER wins, subtract the winning payout from CAP threshold
if under_over_result == 'UNDER':
cap_threshold -= under_payout
......@@ -3660,6 +3666,7 @@ class GamesThread(ThreadedComponent):
logger.info(f"🎯 [EXTRACTION DEBUG] No UNDER/OVER winner - CAP threshold: {cap_threshold:.2f}")
logger.info(f"🎯 [EXTRACTION DEBUG] CAP percentage: {cap_percentage}%, base threshold: {base_cap_threshold:.2f}, final threshold: {cap_threshold:.2f}")
logger.info(f"🎯 [EXTRACTION DEBUG] Accumulated shortfall (cap balance): {accumulated_shortfall:.2f}, Recovery mode: {is_recovery_mode}")
logger.info(f"📊 [EXTRACTION DEBUG] Extraction summary - {len(payouts)} results, total_bet_amount={total_bet_amount:.2f}, CAP={cap_percentage}%, threshold={cap_threshold:.2f}")
logger.info(f"📊 [EXTRACTION DEBUG] All possible results, their payouts, and bet counts:")
......@@ -3679,9 +3686,18 @@ class GamesThread(ThreadedComponent):
expected_redistribution = total_payin_all_bets * (cap_percentage / 100.0)
# Step 6: Filter payouts below adjusted CAP threshold
logger.info(f"🎯 [EXTRACTION DEBUG] Step 6: Filtering payouts below adjusted CAP threshold")
eligible_payouts = {k: v for k, v in payouts.items() if v <= cap_threshold}
logger.info(f"🎯 [EXTRACTION DEBUG] Eligible payouts (≤ {cap_threshold:.2f}): {eligible_payouts}")
# CRITICAL: If in recovery mode (negative cap), we MUST select the minimum payout to recover
if is_recovery_mode:
# In recovery mode, select only the result(s) with the absolute MINIMUM payout
# This ensures we redistribute as little as possible to recover the negative balance
min_payout = min(payouts.values())
eligible_payouts = {k: v for k, v in payouts.items() if v == min_payout}
logger.info(f"🎯 [RECOVERY MODE] Negative cap balance - selecting ONLY results with minimum payout {min_payout:.2f}: {list(eligible_payouts.keys())}")
else:
# Normal mode: filter payouts below adjusted CAP threshold
logger.info(f"🎯 [EXTRACTION DEBUG] Step 6: Filtering payouts below adjusted CAP threshold")
eligible_payouts = {k: v for k, v in payouts.items() if v <= cap_threshold}
logger.info(f"🎯 [EXTRACTION DEBUG] Eligible payouts (≤ {cap_threshold:.2f}): {eligible_payouts}")
if not eligible_payouts:
# No payouts below CAP, select ALL results with the lowest payout
......
# MbetterClient v1.0.16
Cross-platform multimedia client application
## Installation
1. Extract this package to your desired location
2. Run the executable file
3. The application will create necessary configuration files on first run
## System Requirements
- **Operating System**: Linux 6.12.15-amd64
- **Architecture**: x86_64
- **Memory**: 512 MB RAM minimum, 1 GB recommended
- **Disk Space**: 100 MB free space
## Configuration
The application stores its configuration and database in:
- **Windows**: `%APPDATA%\MbetterClient`
- **macOS**: `~/Library/Application Support/MbetterClient`
- **Linux**: `~/.config/MbetterClient`
## Web Interface
By default, the web interface is available at: http://localhost:5001
Default login credentials:
- Username: admin
- Password: admin
**Please change the default password after first login.**
## Support
For support and documentation, please visit: https://git.nexlab.net/mbetter/mbetterc
## Version Information
- Version: 1.0.16
- Build Date: sissy
- Platform: Linux-6.12.15-amd64-x86_64-with-glibc2.42
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