Improve iec_invalid_transition format function (#6682)

This commit is contained in:
Alfredo Cardigliano 2022-06-10 16:17:08 +02:00
parent db0fc0a871
commit df2829d409
2 changed files with 6 additions and 3 deletions

View file

@ -43,7 +43,10 @@ end
-- @param alert_type_params Table `alert_type_params` as built in the `:init` method
-- @return A human-readable string
function alert_iec_invalid_transition.format(ifid, alert, alert_type_params)
local rsp = "[TypeId: ".. iec104_typeids2str(alert_type_params.from) .. " -> ".. iec104_typeids2str(alert_type_params.to) .. "]"
local from = iec104_typeids2str(alert_type_params.from) or alert_type_params.from or i18n('unknown')
local to = iec104_typeids2str(alert_type_params.to) or alert_type_params.to or i18n('unknown')
local rsp = "[TypeId: ".. from .. " -> ".. to .. "]"
-- tprint(rsp)

View file

@ -4988,8 +4988,8 @@ local iec104_typeids = {
function iec104_typeids2str(c)
if(c == nil) then return end
for s,v in pairs(iec104_typeids) do
if(v == c) then
for s, v in pairs(iec104_typeids) do
if(v == tonumber(c)) then
return(s.." (".. v ..")")
end
end