Bug 7196

Summary: Sorting builds table by time causes crash
Product: [Build System, Metadata & Runtime] Toaster Reporter: Mihail Stanciu <stanciux.mihail>
Component: toasterAssignee: Alexandru Damian <alexandru.damian>
Status: VERIFIED FIXED QA Contact: Mihail Stanciu <stanciux.mihail>
Severity: normal    
Priority: Medium+ CC: alexandru.damian, belen.barros.pena, bluelightning, cristiana.voicu
Version: 1.8   
Target Milestone: 1.8 M3   
Hardware: x86   
OS: Multiple   
Whiteboard: all builds page
OS type for building Yocto: --- Type of Regression: Regression (Used to work)
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on: 7165    
Bug Blocks:    
Attachments:
Description Flags
screenshot none

Description Mihail Stanciu 2015-01-20 12:10:59 UTC
Created attachment 2341 [details]
screenshot

Tested on master: d9d5b8b499af3ae01a1e33d0d3969c54c2d4ab1b

Steps to reproduce:

1. Start toaster and create 1 build
2. In the "All Builds" table, enable all columns from the "Edit Columns" menu.
3. Click on column head "Time" to sort by that column

Expected result:
Builds table gets sorted by Time column.

Observed result:
Application crashes with django error. See attached screenshot.

Will attach traceback as well.
Comment 1 Mihail Stanciu 2015-01-20 12:11:23 UTC
Traceback:

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/toastergui/builds/?count=10&orderby=timespent%3A-&page=1

Django Version: 1.5
Python Version: 2.7.6
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.messages',
 'django.contrib.sessions',
 'django.contrib.admin',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'orm',
 'toastermain',
 'south',
 'bldcontrol',
 'bldviewer',
 'toastergui')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/dave/poky/bitbake/lib/toaster/toastergui/views.py" in builds
  1734.         (filter_string, search_term, ordering_string) = _search_tuple(request, BuildRequest)
File "/home/dave/poky/bitbake/lib/toaster/toastergui/views.py" in _search_tuple
  205.         raise BaseException("Invalid ordering model:" + str(model) + str(invalid))

Exception Type: BaseException at /toastergui/builds/
Exception Value: Invalid ordering model:<class 'bldcontrol.models.BuildRequest'>(u'timespent', ['brbitbake', 'brerror', 'brlayer', 'brtarget', 'brvariable', 'build', 'created', 'environment', u'id', 'project', 'state', 'updated'])
Comment 2 Alexandru Damian 2015-01-23 17:49:16 UTC
Pushed for review on 

poky-contrib:adamian/20150123-review
Comment 3 Belen Barros Pena 2015-01-23 18:13:38 UTC
After some discussions about the utility of this sorting criteria and the amount of effort it would take to make it work, we have disabled the sorting by build time, so problem solved.
Comment 4 Alexandru Damian 2015-01-30 13:33:16 UTC
merged in master
Comment 5 Mihail Stanciu 2015-02-02 14:00:08 UTC
Verified on master: 07f2eca7e9f9163ec48d3a417d8ba885a84762f3