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