Skip to content

Commit

Permalink
output-openenergi: properly AND delta/absolute change conditions
Browse files Browse the repository at this point in the history
Fixes GATE-1002
  • Loading branch information
karlp committed Feb 9, 2018
1 parent 98138b2 commit e43906b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions output-openenergi/files/usr/bin/output-openenergi
Expand Up @@ -58,8 +58,9 @@ function CACHE_ENTRY:changed()
if not old then return true end
local change = (new - old)/math.abs(old)
--print("Considering old/new as change:", old, new, change)
if math.abs(change) >= self.opts.delta_percent then return true end
if math.abs(old-new) >= self.opts.delta_absolute then return true end
local delta = math.abs(change) >= self.opts.delta_percent
local absol = math.abs(old-new) >= self.opts.delta_absolute
if delta and absol then return true end
return false
end

Expand Down

0 comments on commit e43906b

Please sign in to comment.