[hg] galaxy 3199: Fixed update time bug in the request grids
details: http://www.bx.psu.edu/hg/galaxy/rev/cadad7fc9284 changeset: 3199:cadad7fc9284 user: rc date: Tue Jan 05 09:53:14 2010 -0500 description: Fixed update time bug in the request grids diffstat: lib/galaxy/web/controllers/requests.py | 27 +++--------------------- lib/galaxy/web/controllers/requests_admin.py | 30 +++++---------------------- 2 files changed, 10 insertions(+), 47 deletions(-) diffs (140 lines): diff -r e5ae8c367b18 -r cadad7fc9284 lib/galaxy/web/controllers/requests.py --- a/lib/galaxy/web/controllers/requests.py Mon Jan 04 15:45:41 2010 -0500 +++ b/lib/galaxy/web/controllers/requests.py Tue Jan 05 09:53:14 2010 -0500 @@ -26,14 +26,6 @@ class TypeColumn( grids.TextColumn ): def get_value(self, trans, grid, request): return request.type.name - class LastUpdateColumn( grids.TextColumn ): - def get_value(self, trans, grid, request): - delta = datetime.utcnow() - request.update_time - if delta > timedelta( minutes=60 ): - last_update = '%s hours' % int( delta.seconds / 60 / 60 ) - else: - last_update = '%s minutes' % int( delta.seconds / 60 ) - return last_update class StateColumn( grids.GridColumn ): def __init__( self, col_name, key, model_class, event_class, filterable, link ): grids.GridColumn.__init__(self, col_name, key=key, model_class=model_class, filterable=filterable, link=link) @@ -92,7 +84,7 @@ title = "Sequencing Requests" template = 'requests/grid.mako' model_class = model.Request - default_sort_key = "-create_time" + default_sort_key = "create_time" num_rows_per_page = 50 preserve_state = True use_paging = True @@ -111,8 +103,7 @@ SamplesColumn( "Sample(s)", link=( lambda item: iff( item.deleted, None, dict( operation="show_request", id=item.id ) ) ), ), TypeColumn( "Type" ), - LastUpdateColumn( "Last update", - format=time_ago ), + grids.GridColumn( "Last Updated", key="update_time", format=time_ago ), DeletedColumn( "Deleted", key="deleted", visible=False, @@ -234,12 +225,7 @@ events_list = [] all_events = request.events for event in all_events: - delta = datetime.utcnow() - event.update_time - if delta > timedelta( minutes=60 ): - last_update = '%s hours' % int( delta.seconds / 60 / 60 ) - else: - last_update = '%s minutes' % int( delta.seconds / 60 ) - events_list.append((event.state, last_update, event.comment)) + events_list.append((event.state, time_ago(event.update_time), event.comment)) return trans.fill_template( '/requests/events.mako', events_list=events_list, request=request) def request_details(self, trans, id): @@ -983,12 +969,7 @@ events_list = [] all_events = sample.events for event in all_events: - delta = datetime.utcnow() - event.update_time - if delta > timedelta( minutes=60 ): - last_update = '%s hours' % int( delta.seconds / 60 / 60 ) - else: - last_update = '%s minutes' % int( delta.seconds / 60 ) - events_list.append((event.state.name, event.state.desc, last_update, event.comment)) + events_list.append((event.state.name, event.state.desc, time_ago(event.update_time), event.comment)) return trans.fill_template( '/sample/sample_events.mako', events_list=events_list, sample_name=sample.name, diff -r e5ae8c367b18 -r cadad7fc9284 lib/galaxy/web/controllers/requests_admin.py --- a/lib/galaxy/web/controllers/requests_admin.py Mon Jan 04 15:45:41 2010 -0500 +++ b/lib/galaxy/web/controllers/requests_admin.py Tue Jan 05 09:53:14 2010 -0500 @@ -31,14 +31,6 @@ class TypeColumn( grids.TextColumn ): def get_value(self, trans, grid, request): return request.type.name - class LastUpdateColumn( grids.TextColumn ): - def get_value(self, trans, grid, request): - delta = datetime.utcnow() - request.update_time - if delta > timedelta( minutes=60 ): - last_update = '%s hours' % int( delta.seconds / 60 / 60 ) - else: - last_update = '%s minutes' % int( delta.seconds / 60 ) - return last_update class StateColumn( grids.GridColumn ): def __init__( self, col_name, key, model_class, event_class, filterable, link ): grids.GridColumn.__init__(self, col_name, key=key, model_class=model_class, filterable=filterable, link=link) @@ -101,7 +93,7 @@ title = "Sequencing Requests" template = "admin/requests/grid.mako" model_class = model.Request - default_sort_key = "-create_time" + default_sort_key = "-update_time" num_rows_per_page = 50 preserve_state = True use_paging = True @@ -121,8 +113,7 @@ link=( lambda item: iff( item.deleted, None, dict( operation="show_request", id=item.id ) ) ), ), TypeColumn( "Type", link=( lambda item: iff( item.deleted, None, dict( operation="view_type", id=item.type.id ) ) ), ), - LastUpdateColumn( "Last update", - format=time_ago ), + grids.GridColumn( "Last Updated", key="update_time", format=time_ago ), DeletedColumn( "Deleted", key="deleted", visible=False, @@ -232,7 +223,7 @@ # ---- Request Controller ------------------------------------------------------ # -class Requests( BaseController ): +class RequestsAdmin( BaseController ): request_grid = RequestsGrid() requesttype_grid = RequestTypeGrid() @@ -528,12 +519,7 @@ events_list = [] all_events = request.events for event in all_events: - delta = datetime.utcnow() - event.update_time - if delta > timedelta( minutes=60 ): - last_update = '%s hours' % int( delta.seconds / 60 / 60 ) - else: - last_update = '%s minutes' % int( delta.seconds / 60 ) - events_list.append((event.state, last_update, event.comment)) + events_list.append((event.state, time_ago(event.update_time), event.comment)) return trans.fill_template( '/admin/requests/events.mako', events_list=events_list, request=request) # @@ -1332,12 +1318,8 @@ events_list = [] all_events = sample.events for event in all_events: - delta = datetime.utcnow() - event.update_time - if delta > timedelta( minutes=60 ): - last_update = '%s hours' % int( delta.seconds / 60 / 60 ) - else: - last_update = '%s minutes' % int( delta.seconds / 60 ) - events_list.append((event.state.name, event.state.desc, last_update, event.comment)) + events_list.append((event.state.name, event.state.desc, + time_ago(event.update_time), event.comment)) widgets, title = self.change_state(trans, sample) return trans.fill_template( '/admin/samples/events.mako', events_list=events_list,
participants (1)
-
Greg Von Kuster