app/models/campaign.rb in e9_crm-0.1.27 vs app/models/campaign.rb in e9_crm-0.1.28
- old
+ new
@@ -56,12 +56,11 @@
SUM(IF(deals.status='won',1,0)) won_deal_count,
SUM(IF(deals.status IN('won','lost'),1,0)) closed_deal_count,
SUM(IF(deals.status='won',deals.value,0)) total_value,
AVG(IF(deals.status='won',deals.value,NULL)) average_value,
- SUM(costs.total) total_cost,
- SUM(costs.total) /
- SUM(IF(deals.status='won',1,0)) average_cost,
+ costs.total total_cost,
+ costs.total / SUM(IF(deals.status='won',1,0)) average_cost,
IFNULL(rv.count, 0) repeat_visits,
IFNULL(nv.count, 0) new_visits,
SUM(DATEDIFF(