Update: 2026-06-30 21:12:26

This commit is contained in:
Hamza-Ayed
2026-06-30 21:12:26 +03:00
parent c2eab19045
commit 1ae8acad7a
14 changed files with 90 additions and 55 deletions

View File

@@ -26,10 +26,10 @@ try {
foreach ($countries as $countryCode) {
// 1. Calculate Average PCI and Market Share
$sql = "SELECT distance_km, total_price
FROM competitor_prices
$sql = "SELECT (price_amount / price_per_km) AS distance_km, price_amount AS total_price
FROM scraped_competitor_prices
WHERE country_code = :country
AND distance_km > 0
AND price_per_km > 0
AND created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY)";
$stmt = $con->prepare($sql);
$stmt->execute([':country' => $countryCode]);