Commit f2058d85 authored by Your Name's avatar Your Name

Fix redistribution cap bug - subtract instead of add overdistribution values

- Fixed bug in games_thread.py where overdistribution values were incorrectly
  added to the redistribution balance instead of subtracted. Now when we
  overdistribute (negative adjustment), we properly DECREASE the balance.
- Added Migration_068 to reset redistribution balance to 0 after the bug fix.
- Version bumped from 10.0.22 to 10.0.23
parent 1fdcd2bf
......@@ -7492,6 +7492,55 @@ class Migration_067_FixMatchResults(DatabaseMigration):
return True
class Migration_068_ResetRedistributionBalance(DatabaseMigration):
"""Reset redistribution balance to zero - one-time migration for bug fix"""
def __init__(self):
super().__init__("068", "Reset redistribution balance to zero")
def up(self, db_manager) -> bool:
"""Reset the accumulated_shortfall in persistent_redistribution_adjustments table to 0
This is a one-time migration to reset the redistribution balance after fixing
the bug where over-distribution values were incorrectly added instead of subtracted.
"""
try:
from datetime import date
with db_manager.engine.connect() as conn:
global_date = date(1970, 1, 1)
# Check if the global record exists
result = conn.execute(text("""
SELECT id, accumulated_shortfall
FROM persistent_redistribution_adjustments
WHERE date = :global_date
"""), {'global_date': global_date})
record = result.fetchone()
if record:
old_value = record[1]
# Reset accumulated_shortfall to 0
conn.execute(text("""
UPDATE persistent_redistribution_adjustments
SET accumulated_shortfall = 0.0
WHERE date = :global_date
"""), {'global_date': global_date})
conn.commit()
logger.info(f"Reset redistribution balance from {old_value} to 0.0")
else:
logger.info("No global redistribution record found - nothing to reset")
return True
except Exception as e:
logger.error(f"Failed to reset redistribution balance: {e}")
return False
def down(self, db_manager) -> bool:
"""Cannot rollback this migration as we don't store the original balance value"""
logger.warning("Cannot rollback Migration_068_ResetRedistributionBalance - original balance value not preserved")
return True
MIGRATIONS: List[DatabaseMigration] = [
Migration_001_InitialSchema(),
Migration_002_AddIndexes(),
......@@ -7560,6 +7609,7 @@ MIGRATIONS: List[DatabaseMigration] = [
Migration_065_AddDefaultStreamingConfig(),
Migration_066_AddWalletTables(),
Migration_067_FixMatchResults(),
Migration_068_ResetRedistributionBalance(),
]
......
# MbetterClient v10.0.22
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: 10.0.22
- 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