Author: tmckay Date: 2014-01-15 21:37:50 +0000 (Wed, 15 Jan 2014) New Revision: 5795
Modified: trunk/cumin/python/cumin/grid/job.py Log: Fix job sorting in the case of blah#2.0 and blah#10.0. Order by numeric id rather than lexical sorting on the name. BZ1020191
Modified: trunk/cumin/python/cumin/grid/job.py =================================================================== --- trunk/cumin/python/cumin/grid/job.py 2014-01-15 21:30:29 UTC (rev 5794) +++ trunk/cumin/python/cumin/grid/job.py 2014-01-15 21:37:50 UTC (rev 5795) @@ -239,6 +239,19 @@ data = self.do_get_data(values) return len(data)
+ def sort_rows(self, rows, options): + if len(rows) > self.max_sortable_records: + return rows + + sort_field = options.sort_field + rev = options.sort_ascending == False + + if sort_field.index == 1: + # For the submissions table, row[0] is a non-visible numerical job id + return sorted(rows, key=lambda row: float(row[0]), reverse=rev) + + return sorted(rows, key=itemgetter(sort_field.index), reverse=rev) + class NonSortableObjectTableColumn(ObjectTableColumn): def __init__(self, app, name, attr): super(NonSortableObjectTableColumn, self).__init__(app, name, attr)
cumin-developers@lists.fedorahosted.org