1

Correction des données météo

This commit is contained in:
2025-11-27 21:35:05 +01:00
parent 7d8388252c
commit bcf7336315
369 changed files with 427 additions and 438 deletions

View File

@@ -93,16 +93,19 @@ async function processFile(filePath, config, { force = false } = {}) {
const weather = await fetchWeather(targetDate, config);
let finalWeather = {};
if (existingWeather && typeof existingWeather === "object") {
if (force) {
finalWeather = weather || {};
} else if (existingWeather && typeof existingWeather === "object") {
finalWeather = JSON.parse(JSON.stringify(existingWeather));
}
if (weather) {
const added = mergeWeather(finalWeather, weather, weather.source?.[0]);
if (!added && Object.keys(finalWeather).length === 0) {
finalWeather = weather;
if (weather) {
const added = mergeWeather(finalWeather, weather, weather.source?.[0]);
if (!added && Object.keys(finalWeather).length === 0) {
finalWeather = weather;
}
}
} else {
finalWeather = weather || {};
}
frontmatter.doc.set("weather", finalWeather);