Fix daily_summary dan hourly_summary aggregation, tambah fallback logic untuk dashboard, update validator untuk camera dan location type
This commit is contained in:
55
bin/check_tariffs.php
Normal file
55
bin/check_tariffs.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?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 "=== Tariffs in database ===\n\n";
|
||||
|
||||
$stmt = $db->query('SELECT location_code, gate_code, category, price FROM tariffs ORDER BY location_code, gate_code, category');
|
||||
$results = $stmt->fetchAll();
|
||||
|
||||
if (empty($results)) {
|
||||
echo "No tariffs found in database!\n";
|
||||
} else {
|
||||
foreach ($results as $row) {
|
||||
$key = $row['location_code'] . '|' . $row['gate_code'] . '|' . $row['category'];
|
||||
echo "Key: $key\n";
|
||||
echo " Location: {$row['location_code']}\n";
|
||||
echo " Gate: {$row['gate_code']}\n";
|
||||
echo " Category: {$row['category']}\n";
|
||||
echo " Price: Rp {$row['price']}\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Check sample events
|
||||
echo "=== Sample events ===\n\n";
|
||||
$stmt = $db->query('SELECT location_code, gate_code, category FROM entry_events ORDER BY event_time DESC LIMIT 5');
|
||||
$events = $stmt->fetchAll();
|
||||
|
||||
foreach ($events as $event) {
|
||||
$key = $event['location_code'] . '|' . $event['gate_code'] . '|' . $event['category'];
|
||||
echo "Event key: $key\n";
|
||||
|
||||
// Check if tariff exists
|
||||
$tariffStmt = $db->prepare('SELECT price FROM tariffs WHERE location_code = ? AND gate_code = ? AND category = ?');
|
||||
$tariffStmt->execute([$event['location_code'], $event['gate_code'], $event['category']]);
|
||||
$tariff = $tariffStmt->fetch();
|
||||
|
||||
if ($tariff) {
|
||||
echo " Tariff found: Rp {$tariff['price']}\n";
|
||||
} else {
|
||||
echo " ⚠️ Tariff NOT found!\n";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user