@piwikpro-team opened this Pull Request on October 10th 2013

Improvements in queryEcommerceItems function which make it works with segments query builder and add support for "log_conversion_item" table in segmenetation to join this table with log_visit.

@mattab commented on October 13th 2013 Member

Thanks for the PR!

The tests are failing: https://travis-ci.org/piwik/piwik/jobs/12363492

eg.

"Table 'log_link_visit_action', can't be joined for segmentation
<a href='/0'>#0</a> /home/travis/build/piwik/piwik/core/Segment.php(175): Piwik\Segment-&gt;generateJoins(Array)

<a href='/1'>#1</a> /home/travis/build/piwik/piwik/core/DataAccess/LogAggregator.php(87): Piwik\Segment-&gt;getSelectQuery('name as label, ...', Array, ' server_time &gt;=...', Array, false, 'ecommerceType, ...')

<a href='/2'>#2</a> /home/travis/build/piwik/piwik/core/DataAccess/LogAggregator.php(354): Piwik\DataAccess\LogAggregator-&gt;generateQuery('name as label, ...', Array, ' server_time &gt;=...', 'ecommerceType, ...', false)

<a href='/3'>#3</a> /home/travis/build/piwik/piwik/plugins/Goals/Archiver.php(236): Piwik\DataAccess\LogAggregator-&gt;queryEcommerceItems('idaction_sku')

<a href='/4'>#4</a> /home/travis/build/piwik/piwik/plugins/Goals/Archiver.php(90): Piwik\Plugins\Goals\Archiver-&gt;archiveEcommerceItems()

<a href='/5'>#5</a> /home/travis/build/piwik/piwik/plugins/Goals/Goals.php(505): Piwik\Plugins\Goals\Archiver-&gt;archiveDay()

<a href='/6'>#6</a> [internal function]: Piwik\Plugins\Goals\Goals-&gt;archiveDay(Object(Piwik\ArchiveProcessor\Day))

<a href='/7'>#7</a> /home/travis/build/piwik/piwik/core/EventDispatcher.php(98): call_user_func_array(Array, Array)

<a href='/8'>#8</a> /home/travis/build/piwik/piwik/core/Piwik.php(658): Piwik\EventDispatcher-&gt;postEvent('ArchiveProcesso...', Array, false, NULL)

<a href='/9'>#9</a> /home/travis/build/piwik/piwik/core/ArchiveProcessor/Day.php(124): Piwik\Piwik::postEvent('ArchiveProcesso...', Array)

<a href='/10'>#10</a> /home/travis/build/piwik/piwik/core/ArchiveProcessor.php(295): Piwik\ArchiveProcessor\Day-&gt;compute()

<a href='/11'>#11</a> /home/travis/build/piwik/piwik/core/ArchiveProcessor.php(198): Piwik\ArchiveProcessor-&gt;computeNewArchive('VisitsSummary', false)

<a href='/12'>#12</a> /home/travis/build/piwik/piwik/core/Archive.php(487): Piwik\ArchiveProcessor-&gt;preProcessArchive('VisitsSummary')

<a href='/13'>#13</a> /home/travis/build/piwik/piwik/core/Archive.php(403): Piwik\Archive-&gt;cacheArchiveIdsAfterLaunching(Array, Array)

Please fix build before I can merge PR.

@mattab commented on October 17th 2013 Member

Along with the PR here are suggestions for new tests:

Then these tests will generate new XML in processed/* directory. You can check these XML are correct and return only those products that were done by visitors matching the segment.

If the XML are valid copy them to the expected/* folder. Then run the tests again, they should pass (or repeat until they pass).

Btw the best way to run all tests is in the root of piwik run:

./console tests:run

if you want to run specific test:

 cd tests/PHPUnit/ && phpunit Integration/EcommerceOrderWithItemsTest.php

Note; running takes takes long time. Hope it helps to make a Pull Request including tests

If travis is green then the PR should be safe to merge (and we know functionnality will not break in the future, which is an amazing feeling!)

@czolnowski commented on November 29th 2013 Contributor

Looks that tests passed. I've add to EcommerceOrderWithItemsTest acceptance tests with segment parameter and it works. :)

This Pull Request was closed on December 8th 2013
Powered by GitHub Issue Mirror