Yaron Koren has submitted this change and it was merged.

Change subject: Added CargoAppliedFilter::getQueryParts()
......................................................................


Added CargoAppliedFilter::getQueryParts()

Change-Id: I8f047c1a3c5a6ed5a2c56484f9e8e7386ebfc3a7
---
M drilldown/CargoAppliedFilter.php
M drilldown/CargoSpecialDrilldown.php
2 files changed, 22 insertions(+), 6 deletions(-)

Approvals:
  Yaron Koren: Verified; Looks good to me, approved



diff --git a/drilldown/CargoAppliedFilter.php b/drilldown/CargoAppliedFilter.php
index b7902f5..906f6e7 100644
--- a/drilldown/CargoAppliedFilter.php
+++ b/drilldown/CargoAppliedFilter.php
@@ -142,6 +142,24 @@
                return $sql;
        }
 
+       function getQueryParts( $mainTableName ) {
+               $cdb = CargoUtils::getDB();
+
+               $tableNames = array();
+               $conds = array();
+               $joinConds = array();
+
+               $conds[] = $this->checkSQL();
+
+               if ( $this->filter->fieldDescription->mIsList ) {
+                       $fieldTableName = $mainTableName . '__' . 
$this->filter->name;
+                       $tableNames[] = $fieldTableName;
+                       $joinConds[$fieldTableName] = 
CargoUtils::joinOfMainAndFieldTable( $cdb, $mainTableName, $fieldTableName );
+               }
+
+               return array( $tableNames, $conds, $joinConds );
+       }
+
        /**
         * Gets an array of all values that this filter has.
         */
diff --git a/drilldown/CargoSpecialDrilldown.php 
b/drilldown/CargoSpecialDrilldown.php
index aec7fa7..f5c7243 100644
--- a/drilldown/CargoSpecialDrilldown.php
+++ b/drilldown/CargoSpecialDrilldown.php
@@ -1045,12 +1045,10 @@
                $conds = array();
                $joinConds = array();
                foreach ( $this->applied_filters as $i => $af ) {
-                       $conds[] = $af->checkSQL();
-                       if ( $af->filter->fieldDescription->mIsList ) {
-                               $fieldTableName = $this->tableName . '__' . 
$af->filter->name;
-                               $tableNames[] = $fieldTableName;
-                               $joinConds[$fieldTableName] = 
CargoUtils::joinOfMainAndFieldTable( $cdb, $this->tableName, $fieldTableName );
-                       }
+                       list( $curTableNames, $curConds, $curJoinConds ) = 
$af->getQueryParts( $this->tableName );
+                       $tableNames = array_merge( $tableNames, $curTableNames 
);
+                       $conds = array_merge( $conds, $curConds );
+                       $joinConds = array_merge( $joinConds, $curJoinConds );
                }
 
                $aliasedFieldNames = array(

-- 
To view, visit https://gerrit.wikimedia.org/r/316390
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8f047c1a3c5a6ed5a2c56484f9e8e7386ebfc3a7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Cargo
Gerrit-Branch: master
Gerrit-Owner: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: Yaron Koren <yaro...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to