TKO doesn't handle time conditions well, time_daily in the condition field does not work properly 

If you click on anything in this query the entire query gets screwed up.  Row and column are both set to tag for no good reason, and the time condition is set equal to a particular second of the day.  The time condition needs to be changed from

time_daily='2008-03-17 00:00:00'
to
time_daily<'2008-03-18 00:00:00'&time_daily>'2008-03-17 00:00:00'

time_daily should map to the SQL "DATE(whatever_the_time_column_is)".  Also, the input to time_daily should have the time stripped off.  I.e. it's not an acceptable solution for 'time_daily = some date' to map to 'time >= some date 00:00:00  &  time <= some date 23:59:59"

From: Vladimir Samarskiy <vsamarsk@google.com>
Signed-off-by: Martin J. Bligh <mbligh@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@1440 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/tko/compose_query.cgi b/tko/compose_query.cgi
index 012c383..8b66145 100755
--- a/tko/compose_query.cgi
+++ b/tko/compose_query.cgi
@@ -66,7 +66,8 @@
     'user': 'tag',
     'status': 'tag',
    
-    'time_daily': 'tag',
+    'time': 'tag',
+    'time_daily': 'time',
 }
 
 
@@ -138,22 +139,6 @@
 def create_select_options(selected_val):
 	ret = ""
 	for option in sorted(frontend.test_view_field_dict.keys()):
-                ## exceptional handling of id and time :(
-                ## To do: when we have more then two such prohibitions,
-                ## something better should be implemented
-                ## e.g. let frontend.test_view_field_dict
-                ## have tuples as a values: (next_field,bAllowGrouping)
-		if option == "id": 
-			## do not allow to group by id 
-			## because it may result in jumbo data transacted
-			continue  
-		if option == "time": 
-			## we have time_daily and time_weekly 
-			## in both drop down menus
-			## They are two different clones of "time"
-			## just 'time' should be avoided due to big
-                        ## data transfer
-			continue  
 		if selected_val == option:
 			selected = " SELECTED"
 		else:
@@ -179,8 +164,6 @@
         ## - possibly, expect more various refinements for different fields
         if field_name == 'kernel':
                 return  map_kernel_base(header)
-        elif field_name.startswith('time') and header != None:
-                return datetime.date(header.year, header.month, header.day)
         else:
                 return header
 
@@ -289,7 +272,7 @@
 		if field_map.has_key(row):
 			dy = field_map[row](y)
 		y_header = header_tuneup(row, dy)
-		link = construct_link(None, y)                
+		link = construct_link(None, y)
 		cur_row = [display.box(y_header, header=True, link=link)]
 		for x in test_data.x_values:
 			## next 2 lines: temporary, until non timestamped
diff --git a/tko/frontend.py b/tko/frontend.py
index 046d8ff..0861bcb 100755
--- a/tko/frontend.py
+++ b/tko/frontend.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 import os, re, db, sys, datetime
-MAX_RECORDS = 10000
-MAX_CELLS = 100000
+MAX_RECORDS = 20000L
+MAX_CELLS = 300000L
 
 tko = os.path.dirname(os.path.realpath(os.path.abspath(__file__)))
 client_bin = os.path.abspath(os.path.join(tko, '../client/bin'))
@@ -55,27 +55,12 @@
 		self.x_values = smart_sort(data.keys(), x_field)
 		# List of rows columns (y-values)
 		self.y_values = smart_sort(list(y_values), y_field)
-		if len(self.y_values)*len(self.x_values) > MAX_CELLS:
+		nCells = len(self.y_values)*len(self.x_values)
+		if nCells > MAX_CELLS:
 			msg = 'Exceeded allowed number of cells in a table'
 			raise db.MySQLTooManyRows(msg)
 			
 
-def truncateTimeFieldsInAllRecords(rows, pos):
-	## reduces hours:min:sec to 00:00:00 in time stamps
-	## in each record i.e. in each element of "rows"
-	## Argument pos is equal to position of x-field or y-field
-	## depending in which field we are going to make such truncation
-	def truncateTimeFieldInOneRecord(row):
-		altRow = list(row)
-		if altRow[pos]!=None:
-			altRow[pos] = datetime.datetime(
-				altRow[pos].year,
-				altRow[pos].month,
-				altRow[pos].day
-				)
-		return tuple(altRow)
-	return map(truncateTimeFieldInOneRecord, rows)
-	            
 def get_matrix_data(db_obj, x_axis, y_axis, where = None):
 	# Searches on the test_view table - x_axis and y_axis must both be
 	# column names in that table.
@@ -87,10 +72,6 @@
 	group_by = '%s, %s, status' % (x_field, y_field)
 	rows = db_obj.select(fields, 'test_view',
 			where=where, group_by=group_by, max_rows = MAX_RECORDS)
-	if x_field.endswith("time"):
-		rows = truncateTimeFieldsInAllRecords(rows, 0)
-	if y_field.endswith("time"):
-		rows = truncateTimeFieldsInAllRecords(rows, 1)
 	return status_data(rows, x_field, y_field)
 
 
@@ -107,8 +88,7 @@
 	'user'          : 'job_username',
 	'status'        : 'status_word',
 	'time'          : 'test_finished_time',
-	'time_daily'    : 'test_finished_time',
-	'id'            : 'test_idx',	    
+	'time_daily'    : 'DATE(test_finished_time)'
 }
 
 def smart_sort(list, field):