deleteForm.innerHTML=`<button type="submit" class="btn btn-danger btn-sm" title="Delete ZIP file" onclick="return confirm('Are you sure you want to delete the ZIP file for Match #${matchId}?')">Delete ZIP</button>`;
deleteForm.innerHTML=`<button type="submit" class="btn btn-danger btn-sm" title="Delete ZIP file" onclick="return confirm('Are you sure you want to delete the ZIP file for Match #${matchId}?')">Delete ZIP</button>`;
# Fixture Manager - Comprehensive Python Daemon System
A sophisticated Python daemon system for Linux servers with internet exposure, implementing a secure web dashboard and RESTful API with robust authentication mechanisms. The system provides advanced file upload capabilities with real-time progress tracking and a comprehensive fixture management system.
## Features
### Core Functionality
-**Secure Web Dashboard**: Modern web interface with authentication and authorization
-**RESTful API**: Comprehensive API with JWT authentication
-**MySQL Database Integration**: Robust database connectivity with connection pooling
# Note: For PyInstaller deployments, configuration will migrate to mbetterd.conf automatically
```
## Configuration
### Configuration File (mbetterd.conf)
The system automatically migrates from `.env` to `mbetterd.conf` stored in persistent directories for PyInstaller compatibility. Configuration settings include:
```bash
# Database Configuration
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=fixture_user
MYSQL_PASSWORD=secure_password
MYSQL_DATABASE=fixture_manager
# Security Configuration
SECRET_KEY=your-secret-key-here
JWT_SECRET_KEY=your-jwt-secret-key
BCRYPT_LOG_ROUNDS=12
# File Upload Configuration
UPLOAD_FOLDER=/var/lib/fixture-daemon/uploads
MAX_CONTENT_LENGTH=524288000 # 500MB
MAX_CONCURRENT_UPLOADS=5
# Server Configuration
HOST=0.0.0.0
PORT=5000
DEBUG=false
```
### Database Schema
The system automatically creates the following tables:
- `users` - User authentication and management
- `matches` - Core fixture data with system fields and status tracking
- `match_outcomes` - Dynamic outcome results
- `api_tokens` - User-generated API tokens for external access
- `file_uploads` - Upload tracking and progress
- `system_logs` - Comprehensive logging
- `user_sessions` - Session management
### Match Status System
The matches table includes a comprehensive status tracking system with 8 predefined states:
**Status Values:**
- `pending` - Initial state, match created but not processed
- `scheduled` - Match scheduled for future processing
- `bet` - Match available for betting
- `ingame` - Match currently in progress
- `cancelled` - Match cancelled
- `failed` - Match processing failed
- `paused` - Match temporarily paused
- `done` - Match completed successfully
**Active Status Criteria:**
A match is considered "active" when ALL of these conditions are met:
- Better error handling and fallback mechanisms for configuration loading
### Previous Updates (v1.2.2) - Bug Fix
- ✅ **Fixture Parser Fighter Column Fix**: Fixed critical bug where both fighter1 and fighter2 were incorrectly mapped to fighter1 column during XLSX upload
- Enhanced [`FixtureParser.detect_required_columns()`](app/upload/fixture_parser.py:179) with specific fighter number matching logic
- Prevents cross-mapping of fighter columns during partial column name matching
- Ensures accurate fighter data separation in database records
- Maintains compatibility with all existing column naming conventions
### Updates (v1.2.1) - PyInstaller Enhancement
- ✅ **Cross-Platform Persistent Directories**: Windows (%APPDATA%), macOS (~/Library/Application Support), Linux (/opt/MBetter)
- ✅ **Configuration Migration**: Automatic .env to mbetterd.conf migration for PyInstaller deployments
- ✅ **Authenticated ZIP Downloads**: Secure API endpoint for ZIP file downloads with token authentication
- ✅ **PyInstaller Detection**: Automatic detection and optimization for PyInstaller environments