From 363a5ed3484443db8b4dd65b2def49d412891b92 Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Wed, 14 Feb 2024 22:49:22 -0600 Subject: [PATCH] Update power.inc.sh --- inc/power.inc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/power.inc.sh b/inc/power.inc.sh index b0170bad..2ac079e4 100644 --- a/inc/power.inc.sh +++ b/inc/power.inc.sh @@ -18,11 +18,11 @@ AVERAGEPOWER(){ total_amp=0 total_watt=0 while IFS=$'\t' read date amp watt ;do - if [ "${amp}" != "" ] && [ "${amp}" != "NULL" ]; then + if [ "${amp}" != "" ] && [ "${amp}" != "0" ] && [ "${amp}" != "NULL" ] && [[ "${amp}" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then total_amp=$(bc <<< "scale=2; ${total_amp}+${amp}") ((logsfound_amp++)) fi - if [ "${watt}" != "" ] && [ "${watt}" != "NULL" ]; then + if [ "${watt}" != "" ] && [ "${watt}" != "0" ] && [ "${watt}" != "NULL" ] && [[ "${watt}" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then total_watt=$(bc <<< "scale=2; ${total_watt}+${watt}") ((logsfound_watt++)) fi