debug
All checks were successful
Deploy / deploy-staging (push) Successful in 6s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-24 23:12:19 +02:00
parent 92c9bed5bb
commit 739e4d4c42
6 changed files with 352 additions and 29 deletions

View File

@@ -427,14 +427,19 @@ final class DashboardPage
throw new RuntimeException((string) ($apiResult['message'] ?? 'API-Abruf fehlgeschlagen.'));
}
$this->storeQuote(
$storeResult = \module_fn(
'boersenchecker',
'store_market_quote',
$instrumentId,
(float) $apiResult['price'],
$quoteCurrency,
(string) $apiResult['fetched_at'],
(string) $apiResult['source']
);
return 'Bavest-Kurs fuer ' . (string) $row['instrument_name'] . ' gespeichert.';
if (!empty($storeResult['inserted'])) {
return 'Bavest-Kurs fuer ' . (string) $row['instrument_name'] . ' gespeichert.';
}
return 'Vorhandener Bavest-Snapshot fuer ' . (string) $row['instrument_name'] . ' wiederverwendet.';
}
private function refreshMarketDataAll(): string
@@ -499,14 +504,20 @@ final class DashboardPage
continue;
}
$this->storeQuote(
$storeResult = \module_fn(
'boersenchecker',
'store_market_quote',
$instrumentId,
(float) $apiResult['price'],
$quoteCurrency,
(string) $apiResult['fetched_at'],
(string) $apiResult['source']
);
$fetched++;
if (!empty($storeResult['inserted'])) {
$fetched++;
} else {
$reused++;
}
}
}

View File

@@ -157,25 +157,26 @@ final class HomePage
if ($bulkCandidates !== []) {
$bulkResult = \module_fn('boersenchecker', 'bavest_fetch_bulk_quotes', $bulkCandidates);
$quotes = is_array($bulkResult['quotes'] ?? null) ? $bulkResult['quotes'] : [];
$stmtInsert = $this->pdo->prepare(
'INSERT INTO ' . $this->quoteTable . ' (instrument_id, price, currency, quoted_at, source)
VALUES (:instrument_id, :price, :currency, :quoted_at, :source)'
);
foreach ($bulkCandidates as $row) {
$instrumentId = (int) ($row['id'] ?? 0);
$quote = $quotes[$instrumentId] ?? null;
if (!is_array($quote) || !is_numeric($quote['price'] ?? null)) {
continue;
}
$stmtInsert->execute([
'instrument_id' => $instrumentId,
'price' => (float) $quote['price'],
'currency' => strtoupper(trim((string) ($quote['currency'] ?? $row['quote_currency'] ?? $this->defaultReportCurrency))) ?: $this->defaultReportCurrency,
'quoted_at' => (string) ($quote['fetched_at'] ?? date('Y-m-d H:i:s')),
'source' => (string) ($quote['source'] ?? 'bavest:quote'),
]);
$updated++;
$storeResult = \module_fn(
'boersenchecker',
'store_market_quote',
$instrumentId,
(float) $quote['price'],
strtoupper(trim((string) ($quote['currency'] ?? $row['quote_currency'] ?? $this->defaultReportCurrency))) ?: $this->defaultReportCurrency,
(string) ($quote['fetched_at'] ?? gmdate('Y-m-d H:i:s')),
(string) ($quote['source'] ?? 'bavest:quote')
);
if (!empty($storeResult['inserted'])) {
$updated++;
} else {
$reused++;
}
}
}

View File

@@ -224,19 +224,19 @@ final class InstrumentPage
throw new RuntimeException((string) ($apiResult['message'] ?? 'API-Abruf fehlgeschlagen.'));
}
$stmtInsert = $this->pdo->prepare(
'INSERT INTO ' . $this->quoteTable . ' (instrument_id, price, currency, quoted_at, source)
VALUES (:instrument_id, :price, :currency, :quoted_at, :source)'
$storeResult = \module_fn(
'boersenchecker',
'store_market_quote',
$instrumentId,
(float) $apiResult['price'],
strtoupper(trim((string) ($instrument['quote_currency'] ?? $this->defaultReportCurrency))) ?: $this->defaultReportCurrency,
(string) $apiResult['fetched_at'],
(string) $apiResult['source']
);
$stmtInsert->execute([
'instrument_id' => $instrumentId,
'price' => (float) $apiResult['price'],
'currency' => strtoupper(trim((string) ($instrument['quote_currency'] ?? $this->defaultReportCurrency))) ?: $this->defaultReportCurrency,
'quoted_at' => (string) $apiResult['fetched_at'],
'source' => (string) $apiResult['source'],
]);
return 'Bavest-Kurs gespeichert.';
return !empty($storeResult['inserted'])
? 'Bavest-Kurs gespeichert.'
: 'Vorhandener Bavest-Snapshot wiederverwendet.';
}
private function searchSymbol(): string