rackem
Well-Known Member
I have a URL list filter that is not behaving as expected. It is similar to some examples in the wiki and one that I use successfully already.
I've added "&fabrikdebug=1" to confirm the list query is correct initially, however, query does not "stick" when changing the number of records or changing pages in the list. I've troubleshooted it down to where it looks like there is a bug that breaks multiple filters on a single element.
The desired basic statement is: WHERE (p1 = 29 OR p2 = 29) AND (game = 2 OR game = 3).
More specifically, the following URL properly creates the query (highlighting added for clarity)
WHERE ( ( `mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29') AND ( `mps_fargo_matches`.`game_id` = '2' OR `mps_fargo_matches`.`game_id` = '3') )
http://www.mypoolstats.com/index.php?option=com_fabrik&view=list&listid=33&resetfilters=1
&mps_fargo_matches___p1_raw[value][]=29
&mps_fargo_matches___p2_raw[value][]=29
&mps_fargo_matches___p2_raw[join][]=OR
&mps_fargo_matches___p2_raw[grouped_to_previous][]=1
&mps_fargo_matches___game_id_raw[join][]=AND
&mps_fargo_matches___game_id_raw[grouped_to_previous][]=0
&mps_fargo_matches___game_id_raw[value][]=2
&mps_fargo_matches___game_id_raw[value][]=3
&mps_fargo_matches___game_id_raw[join][]=OR
&mps_fargo_matches___game_id_raw[grouped_to_previous][]=1
&fabrikdebug=1
However, when the number of records or page is changed pages in the list, the query breaks into
WHERE ( `mps_fargo_matches`.`game_id` = '3' AND ( `mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29') )
Note the logic of the query has changed - one part of the highlighted portion has disappeared and the parenthesis have changed!
So I began troubleshooting.
Here is a similar query that is working properly when the list changes (number of records or page is changed). The basic statement here is: WHERE (p1 = 29 OR p2 = 29) AND game = 2.
http://www.mypoolstats.com/index.php?option=com_fabrik&view=list&listid=33&resetfilters=1
&mps_fargo_matches___p1_raw[value][]=29
&mps_fargo_matches___p2_raw[value][]=29
&mps_fargo_matches___p2_raw[join][]=OR
&mps_fargo_matches___p2_raw[grouped_to_previous][]=1
&mps_fargo_matches___game_id_raw[join][]=AND
&mps_fargo_matches___game_id_raw[grouped_to_previous][]=0
&mps_fargo_matches___game_id_raw[value][]=2
&fabrikdebug=1
This produces
WHERE ( ( `mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29') AND `mps_fargo_matches`.`game_id` = '2' )
When the list changes, the query is
WHERE ( `mps_fargo_matches`.`game_id` = '2' AND ( `mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29') )
Note the order has changed but the logic is consistent.
Simplifying things further, I tried just WHERE (game = 2 OR game = 3) using this URL
http://www.mypoolstats.com/index.php?option=com_fabrik&view=list&listid=33&resetfilters=1
&mps_fargo_matches___game_id_raw[value][]=2
&mps_fargo_matches___game_id_raw[value][]=3
&mps_fargo_matches___game_id_raw[join]=OR
&fabrikdebug=1
This produces
WHERE ( `mps_fargo_matches`.`game_id` = '2' OR `mps_fargo_matches`.`game_id` = '3' )
When the list changes, the query is
WHERE ( `mps_fargo_matches`.`game_id` = '3' )
Note the first value has disappeared! This behavior matches what happened in the more complex query.
It looks like there is a bug that prevents multiple filters on a single element. I confirmed this behavior with a different element. It doesn't matter if OR or AND is used as the join. It seems like perhaps the array of values is being collapsed to only the last entry when the list is changed?
Note the parenthesis structure and statement order are also changing. That's not a problem of course if the logic is consistent, but it may be that is a related issue?
I've added "&fabrikdebug=1" to confirm the list query is correct initially, however, query does not "stick" when changing the number of records or changing pages in the list. I've troubleshooted it down to where it looks like there is a bug that breaks multiple filters on a single element.
The desired basic statement is: WHERE (p1 = 29 OR p2 = 29) AND (game = 2 OR game = 3).
More specifically, the following URL properly creates the query (highlighting added for clarity)
WHERE ( ( `mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29') AND ( `mps_fargo_matches`.`game_id` = '2' OR `mps_fargo_matches`.`game_id` = '3') )
http://www.mypoolstats.com/index.php?option=com_fabrik&view=list&listid=33&resetfilters=1
&mps_fargo_matches___p1_raw[value][]=29
&mps_fargo_matches___p2_raw[value][]=29
&mps_fargo_matches___p2_raw[join][]=OR
&mps_fargo_matches___p2_raw[grouped_to_previous][]=1
&mps_fargo_matches___game_id_raw[join][]=AND
&mps_fargo_matches___game_id_raw[grouped_to_previous][]=0
&mps_fargo_matches___game_id_raw[value][]=2
&mps_fargo_matches___game_id_raw[value][]=3
&mps_fargo_matches___game_id_raw[join][]=OR
&mps_fargo_matches___game_id_raw[grouped_to_previous][]=1
&fabrikdebug=1
However, when the number of records or page is changed pages in the list, the query breaks into
WHERE ( `mps_fargo_matches`.`game_id` = '3' AND ( `mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29') )
Note the logic of the query has changed - one part of the highlighted portion has disappeared and the parenthesis have changed!
So I began troubleshooting.
Here is a similar query that is working properly when the list changes (number of records or page is changed). The basic statement here is: WHERE (p1 = 29 OR p2 = 29) AND game = 2.
http://www.mypoolstats.com/index.php?option=com_fabrik&view=list&listid=33&resetfilters=1
&mps_fargo_matches___p1_raw[value][]=29
&mps_fargo_matches___p2_raw[value][]=29
&mps_fargo_matches___p2_raw[join][]=OR
&mps_fargo_matches___p2_raw[grouped_to_previous][]=1
&mps_fargo_matches___game_id_raw[join][]=AND
&mps_fargo_matches___game_id_raw[grouped_to_previous][]=0
&mps_fargo_matches___game_id_raw[value][]=2
&fabrikdebug=1
This produces
WHERE ( ( `mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29') AND `mps_fargo_matches`.`game_id` = '2' )
When the list changes, the query is
WHERE ( `mps_fargo_matches`.`game_id` = '2' AND ( `mps_fargo_matches`.`p1` = '29' OR `mps_fargo_matches`.`p2` = '29') )
Note the order has changed but the logic is consistent.
Simplifying things further, I tried just WHERE (game = 2 OR game = 3) using this URL
http://www.mypoolstats.com/index.php?option=com_fabrik&view=list&listid=33&resetfilters=1
&mps_fargo_matches___game_id_raw[value][]=2
&mps_fargo_matches___game_id_raw[value][]=3
&mps_fargo_matches___game_id_raw[join]=OR
&fabrikdebug=1
This produces
WHERE ( `mps_fargo_matches`.`game_id` = '2' OR `mps_fargo_matches`.`game_id` = '3' )
When the list changes, the query is
WHERE ( `mps_fargo_matches`.`game_id` = '3' )
Note the first value has disappeared! This behavior matches what happened in the more complex query.
It looks like there is a bug that prevents multiple filters on a single element. I confirmed this behavior with a different element. It doesn't matter if OR or AND is used as the join. It seems like perhaps the array of values is being collapsed to only the last entry when the list is changed?
Note the parenthesis structure and statement order are also changing. That's not a problem of course if the logic is consistent, but it may be that is a related issue?