Davidson CI testing & AI refinement
pauljd/davidson-ci: Davidson CI / quality (push) Successful in 16s
pauljd/davidson-ci: Davidson CI / ai-review (push) Successful in 59s

This commit is contained in:
2026-09-11 11:04:36 +01:00
parent f033480104
commit 6afdd80bfc
2 changed files with 18 additions and 5 deletions
+9 -5
View File
@@ -9,19 +9,23 @@ $pdo = getDbConnection();
enforce_session_version($pdo);
$userId = $_SESSION['user_id'] ?? null;
$waitSince = $_SESSION['purchase_wait_since'] ?? null;
$result = false;
if ($userId !== null) {
if ($userId !== null && $waitSince !== null) {
$tableExists = $pdo->query("SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'transactions'")->fetch();
if ($tableExists) {
$stmt = $pdo->prepare("
// Matches processing.php's session-anchored wait start rather than a sliding
// "now minus N seconds" window, so this keeps recognizing a completed purchase
// no matter how long polling has been going on.
$stmt = $pdo->prepare('
SELECT 1 FROM transactions
WHERE user_id = :user_id
AND created_at >= datetime('now', '-40 seconds')
AND created_at >= :wait_since
LIMIT 1
");
$stmt->execute(['user_id' => (int) $userId]);
');
$stmt->execute(['user_id' => (int) $userId, 'wait_since' => $waitSince]);
$result = (bool) $stmt->fetch();
}
}