From a2dba76eca116e6d5012c08b0e38250f330c8a4f Mon Sep 17 00:00:00 2001 From: Jon Ziebell Date: Tue, 23 Mar 2021 20:32:28 -0400 Subject: [PATCH] Fixed RDD generating as 0 when there's 0 runtime. --- api/profile.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/api/profile.php b/api/profile.php index ea0e774..4d3648c 100644 --- a/api/profile.php +++ b/api/profile.php @@ -951,8 +951,10 @@ class profile extends cora\api { $system_type_heat !== null && $system_type_heat !== 'none' ) { - $profile['runtime_per_degree_day']['heat_1'] = round($profile['runtime']['heat_1'] / $profile['degree_days']['heat'], 2); - if($heat_stages === 2) { + if($profile['runtime']['heat_1'] > 0) { + $profile['runtime_per_degree_day']['heat_1'] = round($profile['runtime']['heat_1'] / $profile['degree_days']['heat'], 2); + } + if($profile['runtime']['heat_2'] > 0) { $profile['runtime_per_degree_day']['heat_2'] = round($profile['runtime']['heat_2'] / $profile['degree_days']['heat'], 2); } } @@ -966,8 +968,10 @@ class profile extends cora\api { $system_type_cool !== null && $system_type_cool !== 'none' ) { - $profile['runtime_per_degree_day']['cool_1'] = round($profile['runtime']['cool_1'] / $profile['degree_days']['cool'], 2); - if($cool_stages === 2) { + if($profile['runtime']['cool_1'] > 0) { + $profile['runtime_per_degree_day']['cool_1'] = round($profile['runtime']['cool_1'] / $profile['degree_days']['cool'], 2); + } + if($profile['runtime']['cool_2'] > 0) { $profile['runtime_per_degree_day']['cool_2'] = round($profile['runtime']['cool_2'] / $profile['degree_days']['cool'], 2); } }