Zero is a valid value for an tag. bug #3399
[irspy-moved-to-github.git] / lib / ZOOM / IRSpy / Utils.pm
index 233222e..2f76045 100644 (file)
@@ -352,7 +352,7 @@ sub modify_xml_document {
            }
 
        } else {
-           next if !$value; # No need to create a new empty node
+           next if !defined $value; # No need to create a new empty node
            my($ppath, $selector) = $xpath =~ /(.*)\/(.*)/;
            dom_add_node($xc, $ppath, $selector, $value, @addAfter);
            #print "New $key ($xpath) = '$value'<br/>\n";
@@ -816,7 +816,7 @@ sub calc_reliability_stats {
     return (0, 0, 0) if $nall == 0;
     my @okpings = $xc->findnodes('i:status/i:probe[@ok = "1"]');
     my $nok = @okpings;
-    my $percent = int(100*$nok/$nall);
+    my $percent = int(100*$nok/$nall + 0.5);
     return ($nok, $nall, $percent);
 }