mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
fix(weather): treat a missing code as unavailable in cloud effects too
Number(null) is 0, so the cockpit cloud profile treated a missing weather code as clear but available. The briefing's three checks now share one helper, and the current-state note is its own bullet instead of folding into the route one.
This commit is contained in:
1 parent
a7e5f341ab
commit
5be2185dc7
4 files changed
+32
-29
No files matched your search
@@ -13,7 +13,13 @@ function range01(value, min, max) {
|
||||
* Missing weather fails clear instead of inventing conditions.
|
||||
*/
|
||||
export function deriveWeatherEffectProfile(weather) {
|
||||
if (!weather || !Number.isFinite(Number(weather.weatherCode))) {
|
||||
const reported = weather?.weatherCode;
|
||||
// Number(null) and Number('') are 0 (clear), so a missing code is checked first.
|
||||
if (
|
||||
reported == null ||
|
||||
reported === '' ||
|
||||
!Number.isFinite(Number(reported))
|
||||
) {
|
||||
return {
|
||||
available: false,
|
||||
cloud: 0,
|
||||
|
||||
Reference in new issue
Block a user