Fix daily_summary dan hourly_summary aggregation, tambah fallback logic untuk dashboard, update validator untuk camera dan location type

This commit is contained in:
mwpn
2025-12-18 11:13:06 +07:00
parent 9416de7d87
commit d05fa2f4cd
31 changed files with 2041 additions and 45 deletions

34
bin/check_gates.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
use App\Config\AppConfig;
use App\Support\Database;
AppConfig::loadEnv(__DIR__ . '/..');
$db = Database::getConnection(
AppConfig::get('DB_HOST'),
AppConfig::get('DB_NAME'),
AppConfig::get('DB_USER'),
AppConfig::get('DB_PASS')
);
echo "=== Gates in database ===\n\n";
$stmt = $db->query('SELECT location_code, gate_code, name, direction, camera, is_active FROM gates ORDER BY location_code, gate_code');
$gates = $stmt->fetchAll();
if (empty($gates)) {
echo "No gates found in database!\n";
} else {
echo "Total gates: " . count($gates) . "\n\n";
foreach ($gates as $gate) {
echo "Location: {$gate['location_code']}\n";
echo " Gate Code: {$gate['gate_code']}\n";
echo " Name: {$gate['name']}\n";
echo " Direction: {$gate['direction']}\n";
echo " Camera: " . ($gate['camera'] ?: 'NULL') . "\n";
echo " Active: " . ($gate['is_active'] ? 'Yes' : 'No') . "\n\n";
}
}