From b0fe1d09f62dfe4cfb1527136422eb62ffb93aa6 Mon Sep 17 00:00:00 2001
From: diosmosis <benaka@piwik.pro>
Date: Tue, 25 Nov 2014 14:29:50 -0800
Subject: [PATCH] Fix Goals.getConversionRate for BC.

---
 plugins/Goals/API.php                                        | 5 ++++-
 ...test_OneVisitorTwoVisits__Goals.getConversionRate_day.xml | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/plugins/Goals/API.php b/plugins/Goals/API.php
index 955825a092..850857ca47 100644
--- a/plugins/Goals/API.php
+++ b/plugins/Goals/API.php
@@ -17,6 +17,7 @@ use Piwik\Db;
 use Piwik\Metrics;
 use Piwik\Piwik;
 use Piwik\Plugin\Report;
+use Piwik\Plugins\CoreHome\Columns\Metrics\ConversionRate;
 use Piwik\Plugins\Goals\Columns\Metrics\AverageOrderRevenue;
 use Piwik\Site;
 use Piwik\Tracker\Cache;
@@ -415,7 +416,9 @@ class API extends \Piwik\Plugin\API
      */
     public function getConversionRate($idSite, $period, $date, $segment = false, $idGoal = false)
     {
-        return $this->getNumeric($idSite, $period, $date, $segment, Archiver::getRecordName('conversion_rate', $idGoal));
+        $table = $this->get($idSite, $period, $date, $segment, $idGoal, 'conversion_rate');
+        $table->setMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, array(new ConversionRate()));
+        return $table;
     }
 
     /**
diff --git a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__Goals.getConversionRate_day.xml b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__Goals.getConversionRate_day.xml
index dff1089a71..01cf6797a0 100644
--- a/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__Goals.getConversionRate_day.xml
+++ b/tests/PHPUnit/System/expected/test_OneVisitorTwoVisits__Goals.getConversionRate_day.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" ?>
-<result>100</result>
\ No newline at end of file
+<result>100%</result>
\ No newline at end of file
-- 
GitLab