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,39 @@
<?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')
);
$dates = ['2025-12-16', '2025-12-17', '2025-12-18'];
echo "=== Checking specific dates ===\n";
foreach ($dates as $date) {
// Check entry_events
$stmt = $db->prepare('SELECT COUNT(*) as count FROM entry_events WHERE DATE(event_time) = ?');
$stmt->execute([$date]);
$entryCount = $stmt->fetch()['count'];
// Check daily_summary
$stmt = $db->prepare('SELECT SUM(total_count) as total FROM daily_summary WHERE summary_date = ?');
$stmt->execute([$date]);
$summaryTotal = $stmt->fetch()['total'] ?? 0;
echo "\nDate: $date\n";
echo " entry_events: $entryCount events\n";
echo " daily_summary: $summaryTotal total\n";
if ($entryCount > 0 && $summaryTotal == 0) {
echo " ⚠️ Data exists in entry_events but not aggregated to daily_summary!\n";
echo " Run: php bin/daily_summary.php $date\n";
}
}