Skip to content
Extraits de code Groupes Projets
Valider 1c0b11cd rédigé par mattpiwik's avatar mattpiwik
Parcourir les fichiers

Refs #1125

 * Example of a simple filter to apply to the datatable in the API method. Filters will automatically work on all dataTable are are easy to write /maintain

 * Fixing tests

git-svn-id: http://dev.piwik.org/svn/trunk@2595 59fd770c-687e-43c8-a1e3-f5a4ff64c105
parent 391a3aa2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -260,6 +260,9 @@ class Piwik_Goals_API ...@@ -260,6 +260,9 @@ class Piwik_Goals_API
{ {
$dataTable->renameColumn($oldName, $columns[$id]); $dataTable->renameColumn($oldName, $columns[$id]);
} }
// conversion_rate has an appended % for consistency with other API outputs
// This filter will work both on DataTable and DataTable_Array
$dataTable->filter('ColumnCallbackReplace', array('conversion_rate', create_function('$label', 'return $label . "%";')));
return $dataTable; return $dataTable;
} }
......
...@@ -45,6 +45,7 @@ abstract class Test_Integration extends Test_Database ...@@ -45,6 +45,7 @@ abstract class Test_Integration extends Test_Database
'Pdfexport', 'Pdfexport',
'API', 'API',
)); ));
$this->setApiToCall( array());
} }
function tearDown() function tearDown()
......
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<result> <result>
<nb_conversions>2</nb_conversions> <nb_conversions>2</nb_conversions>
<conversion_rate>100</conversion_rate> <conversion_rate>100%</conversion_rate>
<revenue>43</revenue> <revenue>43</revenue>
</result> </result>
\ No newline at end of file
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
<nb_visits_converted_returning>1</nb_visits_converted_returning> <nb_visits_converted_returning>1</nb_visits_converted_returning>
<bounce_rate_returning>100%</bounce_rate_returning> <bounce_rate_returning>100%</bounce_rate_returning>
<nb_actions_per_visit_returning>1</nb_actions_per_visit_returning> <nb_actions_per_visit_returning>1</nb_actions_per_visit_returning>
<avg_visit_length_returning>0</avg_visit_length_returning> <avg_time_on_site_returning>0</avg_time_on_site_returning>
</result> </result>
\ No newline at end of file
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
<nb_visits_converted>2</nb_visits_converted> <nb_visits_converted>2</nb_visits_converted>
<bounce_rate>50%</bounce_rate> <bounce_rate>50%</bounce_rate>
<nb_actions_per_visit>3</nb_actions_per_visit> <nb_actions_per_visit>3</nb_actions_per_visit>
<avg_visit_length>810</avg_visit_length> <avg_time_on_site>810</avg_time_on_site>
</result> </result>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<result> <result>
<nb_conversions>0</nb_conversions> <nb_conversions>0</nb_conversions>
<conversion_rate>0</conversion_rate> <conversion_rate>0%</conversion_rate>
<revenue>0</revenue> <revenue>0</revenue>
</result> </result>
\ No newline at end of file
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
<nb_visits_converted_returning>0</nb_visits_converted_returning> <nb_visits_converted_returning>0</nb_visits_converted_returning>
<bounce_rate_returning>0%</bounce_rate_returning> <bounce_rate_returning>0%</bounce_rate_returning>
<nb_actions_per_visit_returning>0</nb_actions_per_visit_returning> <nb_actions_per_visit_returning>0</nb_actions_per_visit_returning>
<avg_visit_length_returning>0</avg_visit_length_returning> <avg_time_on_site_returning>0</avg_time_on_site_returning>
</result> </result>
\ No newline at end of file
...@@ -9,5 +9,5 @@ ...@@ -9,5 +9,5 @@
<nb_visits_converted>0</nb_visits_converted> <nb_visits_converted>0</nb_visits_converted>
<bounce_rate>0%</bounce_rate> <bounce_rate>0%</bounce_rate>
<nb_actions_per_visit>0</nb_actions_per_visit> <nb_actions_per_visit>0</nb_actions_per_visit>
<avg_visit_length>0</avg_visit_length> <avg_time_on_site>0</avg_time_on_site>
</result> </result>
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter