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

$db = getDB();
$stmt = $db->prepare('UPDATE exam_attempts SET status = "submitted" WHERE status = ""');
$result = $stmt->execute();
$updated = $stmt->rowCount();
echo "Updated $updated exam attempts" . PHP_EOL;

// Check the status distribution after update
$stmt = $db->query('SELECT status, COUNT(*) as count FROM exam_attempts GROUP BY status');
$statuses = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo PHP_EOL . 'Updated status distribution:' . PHP_EOL;
foreach ($statuses as $status) {
    echo "- Status: '{$status['status']}' => {$status['count']} attempts" . PHP_EOL;
}
?>