Correction des données météo
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user