Page MenuHomePhabricator

Hide SD filters without values
Closed, DeclinedPublic

Description

If $sdgHideFiltersWithoutValues = true, filters without values will not be displayed. Currently they are rendered with
(There are no values for this filter) as description.

Index: SemanticDrilldown.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- SemanticDrilldown.php	(revision ace7c254706a2fba679ddb1be4d41f273dacf658)
+++ SemanticDrilldown.php	(revision )
@@ -110,6 +110,8 @@
 // other display settings
 $sdgMinValuesForComboBox = 40;
 $sdgNumRangesForNumberFilters = 6;
+$sdgHideFiltersWithoutValues = false;
+
 
 
 /**********************************************/
Index: specials/SD_BrowseData.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- specials/SD_BrowseData.php	(revision ace7c254706a2fba679ddb1be4d41f273dacf658)
+++ specials/SD_BrowseData.php	(revision )
@@ -962,6 +962,7 @@
 		global $sdgScriptPath;
 		global $sdgMinValuesForComboBox;
 		global $sdgFiltersSmallestFontSize, $sdgFiltersLargestFontSize;
+		global $sdgHideFiltersWithoutValues;
 
 		$f->createTempTable();
 		$found_results_for_filter = false;
@@ -1029,6 +1030,11 @@
 
 		$text = $this->printFilterLine( $f->name, false, $normal_filter, $results_line );
 		$f->dropTempTable();
+
+		if ( $sdgHideFiltersWithoutValues && count( $filter_values ) == 0 ) {
+			$text = '';
+		}
+
 		return $text;
 	}

Event Timeline

This patch does a complete removal by default:

Index: specials/SD_BrowseData.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- specials/SD_BrowseData.php	(revision 5e142c6c4e584721a187e51fe880c7f3db29b3dc)
+++ specials/SD_BrowseData.php	(revision )
@@ -1005,9 +1005,7 @@
 
 		$filter_name = urlencode( str_replace( ' ', '_', $f->name ) );
 		$normal_filter = true;
-		if ( count( $filter_values ) == 0 ) {
-			$results_line = '(' . wfMessage( 'sd_browsedata_novalues' )->text() . ')';
-		} elseif ( $f->property_type == 'number' ) {
+		if ( $f->property_type == 'number' ) {
 			$results_line = $this->printNumberRanges( $filter_name, $filter_values );
 		} elseif ( count( $filter_values ) >= $sdgMinValuesForComboBox ) {
 			$results_line = $this->printComboBoxInput( $filter_name, 0, $filter_values );
@@ -1021,6 +1019,11 @@
 
 		$text = $this->printFilterLine( $f->name, false, $normal_filter, $results_line );
 		$f->dropTempTable();
+
+		if ( count( $filter_values ) === 0 ) {
+			$text = '';
+		} else
+
 		return $text;
 	}
Yaron_Koren renamed this task from NEW FEATURE: $sdgHideFiltersWithoutValues to Hide SD filters without values.May 19 2016, 1:34 PM

I think it's better to exit out early, before the results line is created. (You would also need to drop the temp table, of course.)

Yes, you're right. I've tryed that but got a database error and realized I
missed that table.

Aklapper added a subscriber: Yaron_Koren.

This task has been assigned to the same task owner for more than two years. Resetting task assignee due to inactivity, to decrease task cookie-licking and to get a slightly more realistic overview of plans. Please feel free to assign this task to yourself again if you still realistically work or plan to work on this task - it would be welcome!

For tips how to manage individual work in Phabricator (noisy notifications, lists of task, etc.), see https://phabricator.wikimedia.org/T228575#6237124 for available options.
(For the records, two emails were sent to assignee addresses before resetting assignees. See T228575 for more info and for potential feedback. Thanks!)