feat: Enhanced match active status logic with status='pending' requirement

- Updated set_active() method to require status='pending' in addition to ZIP upload completion
- Added comprehensive documentation for new active status criteria
- Updated CHANGELOG.md with version 1.2.3 details
- Enhanced README.md with active status requirements documentation

Active status now requires:
1. ZIP upload status = 'completed'
2. ZIP checksum present
3. Match status = 'pending'

This provides more precise control over match activation workflow.
parent c924ad24
......@@ -8,34 +8,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.2.3] - 2025-08-26
### Added
- **Match Status System**: Comprehensive status tracking for matches table
- New `status` column with 8 predefined enum values: pending, scheduled, bet, ingame, cancelled, failed, paused, done
- **Match Status System**: Comprehensive 8-state status tracking for matches
- New `status` column with enum values: 'pending', 'scheduled', 'bet', 'ingame', 'cancelled', 'failed', 'paused', 'done'
- Default status 'pending' for all new matches
- Database migration system integration (Migration_006)
- Web interface integration with status display in match detail pages
- API endpoints include status information in JSON responses
- **Enhanced Configuration Auto-Migration**: Improved persistent directory configuration system
- Automatic copying of `.env` to persistent config directory when `mbetterd.conf` doesn't exist
- Cross-platform directory detection with proper fallback mechanisms
- Better error handling and logging for configuration loading
- Support for running as root with `/opt/MBetter` directory preference
- Database migration Migration_006 for schema updates
- Web interface integration showing status information
- API endpoints include status in responses
### Enhanced
- **Match Detail Template**: Updated to display both active status and new status column
- **Database Schema**: Enhanced matches table with comprehensive status tracking
- **Active Status Logic**: Updated to require match status='pending' in addition to ZIP upload completion
- Match is now considered "active" only when: ZIP upload completed + checksum present + status='pending'
- More precise control over match activation workflow
- Better separation between upload completion and match processing states
### Fixed
- **Database Configuration**: Fixed MySQL/MariaDB authentication issues
- **Configuration Loading**: Robust fallback mechanisms for various deployment scenarios
- **PyInstaller Compatibility**: Cross-platform persistent directory system
### Technical Details
- **Database Migration**: New Migration_006_AddStatusColumn with proper up/down methods
- **Model Updates**: Match model includes status field with enum validation
- **Template Updates**: Match detail pages show status information with proper formatting
- **Configuration**: Enhanced config.py with automatic .env to persistent config migration
### Security
- All existing security measures remain in place
- Status column properly validated and sanitized
- No changes to authentication or authorization systems
- **Database Schema**: Added status column (enum, indexed, default 'pending')
- **Model Updates**: Enhanced Match model with status field and updated set_active() logic
- **Migration System**: New Migration_006 with proper rollback support
- **Web Interface**: Updated templates to display status information
- **API Integration**: Status field included in all match-related API responses
---
......
......@@ -141,6 +141,12 @@ The matches table includes a comprehensive status tracking system with 8 predefi
- `paused` - Match temporarily paused
- `done` - Match completed successfully
**Active Status Criteria:**
A match is considered "active" when ALL of these conditions are met:
1. **ZIP Upload Status**: `zip_upload_status == 'completed'`
2. **ZIP File Checksum**: `zip_sha1sum` is present (not null/empty)
3. **Match Status**: `status == 'pending'` (new requirement)
**Status Features:**
- **Automatic Migration**: New column added via database migration system
- **Default Value**: All new matches default to 'pending' status
......
......@@ -162,11 +162,13 @@ class Match(db.Model):
return sha1_hash.hexdigest()
def set_active(self):
"""Set match as active (both fixture and ZIP uploaded successfully)"""
if self.zip_upload_status == 'completed' and self.zip_sha1sum:
"""Set match as active (both fixture and ZIP uploaded successfully, and status is pending)"""
if (self.zip_upload_status == 'completed' and
self.zip_sha1sum and
self.status == 'pending'):
self.active_status = True
db.session.commit()
# Check if all matches in this fixture are now active
self.update_fixture_active_time()
return True
......
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