fix: WMOcode for openmeteo implmentation
This commit is contained in:
parent
288895f065
commit
dbd289762a
@ -44,18 +44,20 @@ public class OpenMeteo implements WeatherDataAPI {
|
||||
return JSONFetcher.fetch(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* return condition based on the WMOCode
|
||||
* table can be find here : https://open-meteo.com/en/docs (at the end)
|
||||
* @param WMOCode id code
|
||||
* @return weather condition
|
||||
*/
|
||||
private static Condition getConditionFromCode(int WMOCode) {
|
||||
// TODO Wesh Nemo c'est quoi cette merde ?
|
||||
if (WMOCode == 2 )
|
||||
return Condition.PARTIAL;
|
||||
if (WMOCode < 20)
|
||||
return Condition.SUNNY;
|
||||
else if (WMOCode < 30)
|
||||
return Condition.RAINY;
|
||||
else if (WMOCode < 50)
|
||||
return Condition.CLOUDY;
|
||||
else
|
||||
return Condition.RAINY;
|
||||
return switch (WMOCode) {
|
||||
case 0, 1 -> Condition.SUNNY;
|
||||
case 2 -> Condition.PARTIAL;
|
||||
case 3 -> Condition.CLOUDY;
|
||||
case 61, 63, 65, 80, 81, 82 -> Condition.RAINY;
|
||||
default -> Condition.ERROR;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user