Bug 7196 - Sorting builds table by time causes crash
Summary: Sorting builds table by time causes crash
Status: VERIFIED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 1.8
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 1.8 M3
Assignee: Alexandru Damian
QA Contact: Mihail Stanciu
URL:
Whiteboard: all builds page
Depends on: 7165
Blocks:
  Show dependency tree
 
Reported: 2015-01-20 12:10 UTC by Mihail Stanciu
Modified: 2015-02-02 14:00 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: Regression (Used to work)
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
screenshot (114.25 KB, image/jpeg)
2015-01-20 12:10 UTC, Mihail Stanciu
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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