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

View File

@@ -0,0 +1,50 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
use App\Config\AppConfig;
use App\Support\Database;
use App\Modules\Retribusi\Realtime\RealtimeService;
AppConfig::loadEnv(__DIR__ . '/..');
$db = Database::getConnection(
AppConfig::get('DB_HOST'),
AppConfig::get('DB_NAME'),
AppConfig::get('DB_USER'),
AppConfig::get('DB_PASS')
);
$service = new RealtimeService($db);
echo "=== Testing Entry Events API ===\n\n";
// Test getEntryEvents
$page = 1;
$limit = 20;
$data = $service->getEntryEvents($page, $limit, null, null, null, null, null);
$total = $service->getEntryEventsTotal(null, null, null, null, null);
echo "Total events: $total\n";
echo "Events returned: " . count($data) . "\n\n";
if (!empty($data)) {
echo "Sample events:\n";
foreach (array_slice($data, 0, 5) as $event) {
echo " - ID: {$event['id']}\n";
echo " Time: {$event['event_time']}\n";
echo " Location: {$event['location_code']}\n";
echo " Gate: {$event['gate_code']}\n";
echo " Category: {$event['category']}\n";
echo "\n";
}
} else {
echo "No events found!\n";
}
// Test dengan date filter
echo "\n=== Test dengan date filter (2025-12-18) ===\n";
$data = $service->getEntryEvents($page, $limit, null, null, null, '2025-12-18', '2025-12-18');
$total = $service->getEntryEventsTotal(null, null, null, '2025-12-18', '2025-12-18');
echo "Total events for 2025-12-18: $total\n";
echo "Events returned: " . count($data) . "\n";