From ded344fd6578587e90a5668f75d3b7c0ab08e0f6 Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Mon, 22 Jun 2026 02:00:04 +0200 Subject: [PATCH] bug fixes --- modules/mining-checker/src/Api/Router.php | 3 +++ .../src/Infrastructure/MiningRepository.php | 26 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/modules/mining-checker/src/Api/Router.php b/modules/mining-checker/src/Api/Router.php index c71cb7ca..c90524fb 100644 --- a/modules/mining-checker/src/Api/Router.php +++ b/modules/mining-checker/src/Api/Router.php @@ -1284,6 +1284,9 @@ final class Router 'row_count' => count($rows), 'limit' => self::BOOTSTRAP_MEASUREMENT_LIMIT, ]); + + $rows = $this->ensureMeasurementFxReferences($projectKey, $rows, $settings); + return $this->analytics()->enrichMeasurements($rows, $settings, [ 'full_latest_only' => in_array($view, ['overview', 'mining'], true), ]); diff --git a/modules/mining-checker/src/Infrastructure/MiningRepository.php b/modules/mining-checker/src/Infrastructure/MiningRepository.php index fbeba227..2f6d13c5 100644 --- a/modules/mining-checker/src/Infrastructure/MiningRepository.php +++ b/modules/mining-checker/src/Infrastructure/MiningRepository.php @@ -133,7 +133,18 @@ final class MiningRepository 'SELECT * FROM ' . $this->table('cost_plans') . ' WHERE project_key = :project_key AND owner_sub = :owner_sub ORDER BY starts_at DESC, id DESC' ); $stmt->execute(['project_key' => $projectKey, 'owner_sub' => $this->ownerSub]); - return $this->normalizeRows($stmt->fetchAll() ?: []); + $rows = $this->normalizeRows($stmt->fetchAll() ?: []); + if ($rows !== []) { + return $rows; + } + + // Legacy fallback: older cost plan rows may exist without a user scope assignment. + $legacyStmt = $this->pdo->prepare( + 'SELECT * FROM ' . $this->table('cost_plans') . ' WHERE project_key = :project_key ORDER BY starts_at DESC, id DESC' + ); + $legacyStmt->execute(['project_key' => $projectKey]); + + return $this->normalizeRows($legacyStmt->fetchAll() ?: []); } public function saveCostPlan(string $projectKey, array $payload): array @@ -793,7 +804,18 @@ final class MiningRepository 'SELECT * FROM ' . $this->table('purchased_miners') . ' WHERE project_key = :project_key AND owner_sub = :owner_sub ORDER BY purchased_at DESC, id DESC' ); $stmt->execute(['project_key' => $projectKey, 'owner_sub' => $this->ownerSub]); - return $this->normalizeRows($stmt->fetchAll() ?: []); + $rows = $this->normalizeRows($stmt->fetchAll() ?: []); + if ($rows !== []) { + return $rows; + } + + // Legacy fallback: older purchased miner rows may exist without a user scope assignment. + $legacyStmt = $this->pdo->prepare( + 'SELECT * FROM ' . $this->table('purchased_miners') . ' WHERE project_key = :project_key ORDER BY purchased_at DESC, id DESC' + ); + $legacyStmt->execute(['project_key' => $projectKey]); + + return $this->normalizeRows($legacyStmt->fetchAll() ?: []); } public function getPurchasedMiner(string $projectKey, int $minerId): ?array