Clean-up severe thunderstorm and tornado alert presentation

This commit is contained in:
2025-03-18 01:13:27 -04:00
parent 2a5aa26e5c
commit e37e4d7718
2 changed files with 35 additions and 16 deletions

View File

@ -34,13 +34,20 @@ let tornado = alerts.filter(function(alert) {
// If there are any alerts, return them
msg.ts = ts
msg.ts_count = ts.length
let tstormMsg = {
"payload": {
"alerts": ts,
"count": ts.length,
"tornado_possible": tstp.length
}
}
msg.tstp = tstp
msg.tstp_count = tstp.length
let tornadoWarnMsg = {
"payload": {
"alerts": tornado,
"count": tornado.length
}
}
msg.tornado = tornado
msg.tornado_count = tornado.length
return msg
node.send([tstormMsg,tornadoWarnMsg])
node.status({fill:'green',shape:'dot',text:'Alerts Updated'})

View File

@ -1,4 +1,5 @@
let alerts = msg.payload.features
let tornado_possible = false
// Filter for Severe Thunderstorm Warnings
@ -23,6 +24,10 @@ let tstp = alerts.filter(function(alert) {
}
})
if (tstp.length > 0) {
tornado_possible = true
}
// Filter for Tornado Warnings
let tornado = alerts.filter(function(alert) {
@ -34,13 +39,20 @@ let tornado = alerts.filter(function(alert) {
// If there are any alerts, return them
msg.ts = ts
msg.ts_count = ts.length
let tstormMsg = {
"payload": {
"alerts": ts,
"count": ts.length,
"tornado_possible": tornado_possible
}
}
msg.tstp = tstp
msg.tstp_count = tstp.length
let tornadoWarnMsg = {
"payload": {
"alerts": tornado,
"count": tornado.length
}
}
msg.tornado = tornado
msg.tornado_count = tornado.length
return msg
node.send([tstormMsg,tornadoWarnMsg])
node.status({fill:'green',shape:'dot',text:'Alerts Updated'})