Monatsvorhersage gefixt
This commit is contained in:
@@ -800,17 +800,47 @@ if (!function_exists('monthForecastBuildNarrativeText')) {
|
|||||||
|
|
||||||
$moonEvents = $findEvents(
|
$moonEvents = $findEvents(
|
||||||
$filteredEvents,
|
$filteredEvents,
|
||||||
static fn (array $event): bool => in_array((string) ($event['type'] ?? ''), ['moon_phase', 'golden_handle', 'moon_planet_approach', 'moon_deep_sky_approach', 'moon_occultation', 'moon_apsis'], true),
|
static fn (array $event): bool => in_array((string) ($event['type'] ?? ''), ['moon_phase', 'golden_handle', 'moon_planet', 'moon_planet_approach', 'moon_deep_sky', 'moon_deep_sky_approach', 'moon_occultation', 'moon_apsis'], true),
|
||||||
4
|
10
|
||||||
);
|
);
|
||||||
if ($moonEvents !== []) {
|
if ($moonEvents !== []) {
|
||||||
$moonIntro = $pickRandomText([
|
// Chronologisch sortieren nach local_iso
|
||||||
'Auch der Mond liefert im Laufe des Monats einige markante Beobachtungsmomente.',
|
$sortedMoonEvents = $moonEvents;
|
||||||
'Der Mond zeigt im Monatsverlauf mehrere gut beobachtbare Phasen und Konstellationen.',
|
usort($sortedMoonEvents, static fn (array $a, array $b): int => strcmp(
|
||||||
'Am Mond ergeben sich im Laufe des Monats einige auffällige Termine und Begegnungen.',
|
(string) ($a['local_iso'] ?? $a['date'] ?? ''),
|
||||||
'Der Mond bietet im Monatsverlauf mehrere charakteristische Beobachtungssituationen.',
|
(string) ($b['local_iso'] ?? $b['date'] ?? '')
|
||||||
], 'Auch der Mond liefert im Laufe des Monats einige markante Beobachtungsmomente.');
|
));
|
||||||
$paragraphs[] = $moonIntro . ' Besonders auffällig sind ' . $describeEvents($moonEvents) . '.';
|
|
||||||
|
// Natürlichsprachliche Liste: "Vollmond ist am 01.05., Apogäum am 05.05. und Neumond am 16.05."
|
||||||
|
$moonParts = [];
|
||||||
|
foreach ($sortedMoonEvents as $me) {
|
||||||
|
$label = trim((string) ($me['event'] ?? ''));
|
||||||
|
$date = trim((string) ($me['date'] ?? ''));
|
||||||
|
if ($label === '' || $date === '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// "Mond bedeckt X" → "der Mond bedeckt X" für natürlicheren Satzbau
|
||||||
|
if (str_starts_with($label, 'Mond bedeckt ')) {
|
||||||
|
$label = 'der ' . $label;
|
||||||
|
}
|
||||||
|
$moonParts[] = ['label' => $label, 'date' => $date];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($moonParts !== []) {
|
||||||
|
$moonSentenceParts = [];
|
||||||
|
foreach ($moonParts as $idx => $part) {
|
||||||
|
if ($idx === 0) {
|
||||||
|
$moonSentenceParts[] = $part['label'] . ' ist am ' . $part['date'];
|
||||||
|
} else {
|
||||||
|
$moonSentenceParts[] = $part['label'] . ' am ' . $part['date'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$lastPart = array_pop($moonSentenceParts);
|
||||||
|
$moonSentence = $moonSentenceParts !== []
|
||||||
|
? implode(', ', $moonSentenceParts) . ' und ' . $lastPart
|
||||||
|
: $lastPart;
|
||||||
|
$paragraphs[] = $moonSentence . '.';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$planetObservationEvents = $findEvents(
|
$planetObservationEvents = $findEvents(
|
||||||
|
|||||||
Reference in New Issue
Block a user