<?php
// fix_slots.php
// Script to force update database settings to 4 slots per hour (15 minutes)

require_once '../config/database.php';

header('Content-Type: text/html');

try {
    $pdo = getDBConnection();
    
    // Check current value
    $stmt = $pdo->prepare("SELECT setting_value FROM settings WHERE setting_key = 'slots_per_hour'");
    $stmt->execute();
    $current = $stmt->fetchColumn();
    
    echo "<h1>Fixing Slot Settings</h1>";
    echo "<p>Current slots_per_hour: <strong>" . ($current ? $current : 'Not Set') . "</strong></p>";
    
    // Update to 4
    $sql = "UPDATE settings SET setting_value = '4' WHERE setting_key = 'slots_per_hour'";
    $stmt = $pdo->prepare($sql);
    $stmt->execute();
    
    echo "<p style='color: green; font-weight: bold;'>SUCCESS: Updated slots_per_hour to 4.</p>";
    echo "<p>Your slots should now be 15 minutes (60 / 4).</p>";
    
} catch (PDOException $e) {
    echo "<h2 style='color: red;'>Error</h2>";
    echo "<p>" . $e->getMessage() . "</p>";
}
?>
