@tsteur opened this issue on March 18th 2015

I noticed sometimes a label filter does not work. This is because the DataTable thinks the IndexFromLabelToId is up to date but it is not. It will then fail to get the row by label.

Here it [https://github.com/piwik/piwik/blob/2.12.0-b5/core/API/DataTableManipulator/LabelFilter.php#L72](tries to get the row by label) and [https://github.com/piwik/piwik/blob/2.12.0-b5/core/DataTable.php#L610](here it thinks the index is up to date which it is not).

How can this happen?

When we update the label on a row directly eg via $row->setColumn('labe'l, 'newvalue') the dataTable won't notice that the index has to be updated. Same when doing eg $table->queueFilter('ColumnCallbackReplace', array('label', 'Piwik\Plugins\Referrers\getPathFromUrl')); or $table->queueFilter('GroupBy', array('label', 'Piwik\Plugins\Referrers\getPathFromUrl')); for example here: https://github.com/piwik/piwik/blob/2.12.0-b5/plugins/Referrers/DataTable/Filter/UrlsFromWebsiteId.php

For now the only way to make sure the index is up date when applying the label filter is to rebuild it. In another pull request I will on top invalidate the index for those 2 filters but this does not actually solve all problems. Only by rebuilding the index we can be sure to have the correct index.

@tsteur commented on March 18th 2015

Actually I will include this pull request in another pull request. Sorry for that.

This issue was closed on March 18th 2015
Powered by GitHub Issue Mirror