From: Vimal Joseph Date: Tue, 16 Dec 2014 15:34:46 +0000 (+0530) Subject: Fix issue with negative starting amount in the progressbar X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9cf1439f87b34c65e75d3c20a0ecb83616a29b3e;p=com.zyxware.civiwci.git Fix issue with negative starting amount in the progressbar --- diff --git a/CRM/Wci/BAO/ProgressBar.php b/CRM/Wci/BAO/ProgressBar.php index 9ef635d..bff02bc 100644 --- a/CRM/Wci/BAO/ProgressBar.php +++ b/CRM/Wci/BAO/ProgressBar.php @@ -116,13 +116,8 @@ class CRM_Wci_BAO_ProgressBar extends CRM_Wci_DAO_ProgressBar { $amount_collected = CRM_Wci_BAO_ProgressBar::getPBCollectedAmount($pbId); $amount_raised = $amount_collected + $pbInfo['starting_amount']; $goal = $pbInfo['goal_amount']; - $pbData['pb_collected'] = $amount_raised; - if ($amount_raised < 0) { - $pbData["pb_percentage"] = 0; - } - else { - $pbData["pb_percentage"] = ($amount_raised / $goal) * 100; - } + $pbData['pb_collected'] = ($amount_raised < 0) ? 0 : $amount_raised; + $pbData["pb_percentage"] = ($pbData['pb_collected'] / $goal) * 100; $pbData["goal_amount"] = $goal; $pbData["no_pb"] = False; } else {