Yaron Koren has submitted this change and it was merged. Change subject: Removed caching from CargoFilter::getTimePeriod() ......................................................................
Removed caching from CargoFilter::getTimePeriod() Change-Id: I37ff98d232b517b431c30dbbe49a916bcba78e45 --- M drilldown/CargoFilter.php 1 file changed, 4 insertions(+), 11 deletions(-) Approvals: Yaron Koren: Verified; Looks good to me, approved diff --git a/drilldown/CargoFilter.php b/drilldown/CargoFilter.php index a5e1204..1573893 100644 --- a/drilldown/CargoFilter.php +++ b/drilldown/CargoFilter.php @@ -13,7 +13,6 @@ public $tableName; public $fieldType; public $fieldDescription; - public $time_period = null; public $allowed_values; public $required_filters = array(); public $possible_applied_filters = array(); @@ -41,11 +40,6 @@ // If it's not a date field, return null. if ( $this->fieldDescription->mType != 'Date' ) { return null; - } - - // If it has already been set, just return it. - if ( $this->time_period != null ) { - return $this->time_period; } $cdb = CargoUtils::getDB(); @@ -76,15 +70,14 @@ $yearDifference = $maxYear - $minYear; $monthDifference = ( 12 * $yearDifference ) + ( $maxMonth - $minMonth ); if ( $yearDifference > 30 ) { - $this->time_period = 'decade'; + return 'decade'; } elseif ( $yearDifference > 2 ) { - $this->time_period = 'year'; + return 'year'; } elseif ( $monthDifference > 1 ) { - $this->time_period = 'month'; + return 'month'; } else { - $this->time_period = 'day'; + return 'day'; } - return $this->time_period; } /** -- To view, visit https://gerrit.wikimedia.org/r/316373 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I37ff98d232b517b431c30dbbe49a916bcba78e45 Gerrit-PatchSet: 3 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