Author: croberts
Date: 2012-12-05 18:02:58 +0000 (Wed, 05 Dec 2012)
New Revision: 5563
Modified:
trunk/cumin/python/cumin/objectselector.py
Log:
BZ 879257: cleaning-up searching of the Enqueued column by creating a custom sql filter.
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2012-12-04 17:37:21 UTC (rev 5562)
+++ trunk/cumin/python/cumin/objectselector.py 2012-12-05 18:02:58 UTC (rev 5563)
@@ -443,7 +443,7 @@
if sql_column.type.literal == "timestamp":
searchvalue = parse_date_from_string(customvalue)
- self.adapter.query.add_filter(self.SelectableFieldDateValueFilter(sql_column,
searchvalue, operator))
+
self.adapter.query.add_filter(self.SelectableFieldDateEnqueuedValueFilter(sql_column,
searchvalue, operator))
elif sql_column.type.literal == "int8" or sql_column.type.literal ==
"float8":
if sql_column.name in self.special_columns:
#adjust our search value to be an int based on the timestamp
@@ -540,6 +540,10 @@
class SelectableFieldDateValueFilter(SqlDateValueFilter, SelectableFieldFilter):
pass
+ class SelectableFieldDateEnqueuedValueFilter(SqlDateValueFilter,
SelectableFieldFilter):
+ def emit(self):
+ return "date_trunc('second', %s) %s date_trunc('second',
timestamp '%s')" % (self.this, self.operator, self.that)
+
class SelectableFieldUptimeValueFilter(SqlValueFilter, SelectableFieldFilter):
#necessary because we only show day:hour:minute to the user, but we store seconds
in
#the cumin database. This filter takes the value from the user, and
Show replies by date