Fix for NaN values on startup that upset Javascript JSON decoders
This commit is contained in:
parent
26437e00ea
commit
323fc26754
1 changed files with 4 additions and 1 deletions
|
@ -20,6 +20,7 @@ import signal
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
import math
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -135,7 +136,9 @@ def loop_body(opts, gstate):
|
||||||
if not "dish_{0}".format(category) in data:
|
if not "dish_{0}".format(category) in data:
|
||||||
data["dish_{0}".format(category)] = {}
|
data["dish_{0}".format(category)] = {}
|
||||||
|
|
||||||
data["dish_{0}".format(category)].update({key: val})
|
# Skip NaN values that occur on startup because they can upset Javascript JSON parsers
|
||||||
|
if not ((type(val) == float) and math.isnan(val)):
|
||||||
|
data["dish_{0}".format(category)].update({key: val})
|
||||||
|
|
||||||
|
|
||||||
def cb_add_sequence(key, val, category, _):
|
def cb_add_sequence(key, val, category, _):
|
||||||
|
|
Loading…
Reference in a new issue