bug fixes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user