Skip to content

Commit

Permalink
Set skiinfo first and weatherjs second
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuSchl committed Feb 10, 2024
1 parent d129fd5 commit ae20acd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions back_node/utils/wheather/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ const weatherJs = process.env.IS_TEST ? mockWeatherJs : require("./weather-js").
module.exports.getWheather = async ({ city, forceNoData }) => {
if (!forceNoData) {
const resultWeatherJs = await weatherJs({ city });
if (resultWeatherJs && resultWeatherJs.length !== 0) {
if (skiStationData[city.toLowerCase()]) {
return { type: "skiinfo", data: skiStationData[city] };
} else if (resultWeatherJs && resultWeatherJs.length !== 0) {
const cityResult = resultWeatherJs[0];

const location = cityResult.location.name;
Expand All @@ -34,8 +36,6 @@ module.exports.getWheather = async ({ city, forceNoData }) => {
const windSpeed = cityResult.current.windspeed;
const imageUrl = cityResult.current.imageUrl;
return { type: "weatherJs", location, temperature, humidity, windSpeed, imageUrl };
} else if (skiStationData[city.toLowerCase()]) {
return { type: "skiinfo", data: skiStationData[city] };
}
}
return null;
Expand Down

0 comments on commit ae20acd

Please sign in to comment.