Fix daily_summary dan hourly_summary aggregation, tambah fallback logic untuk dashboard, update validator untuk camera dan location type
This commit is contained in:
39
bin/check_specific_dates.php
Normal file
39
bin/check_specific_dates.php
Normal 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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user