Bug 5921 - Task outcomes are sorted by database value, instead of alphabetically
Summary: Task outcomes are sorted by database value, instead of alphabetically
Status: RESOLVED FIXED
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 1.6.1
Hardware: All Multiple
: Medium normal
Target Milestone: 1.6.1
Assignee: David Reyna
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2014-03-06 16:29 UTC by Belen Barros Pena
Modified: 2014-07-31 16:42 UTC (History)
6 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Belen Barros Pena 2014-03-06 16:29:58 UTC
The outcomes seem to be sorted by database value, which means that you see the outcomes in this order:

Succeeded
Covered
Cached
Prebuilt
Failed
Empty

Of course, the above makes no sense when you are looking at the strings in the Toaster interface. They should be sorted in alphabetical order:

Cached
Covered
Empty
Failed
Prebuilt
Succeeded
Comment 1 Belen Barros Pena 2014-03-06 16:31:34 UTC
toaster/master:213fef6e87cbf60d773e28d31653e3c626d4058e
Comment 2 Alexandru Damian 2014-03-11 15:52:50 UTC
Is this a specific page ? How can I view this ?
Comment 3 Belen Barros Pena 2014-03-11 16:07:11 UTC
(In reply to comment #2)
> Is this a specific page ? How can I view this ?

Sorry: I wasn't very clear. In the tasks table, sort by the Outcome column.
Comment 4 Alexandru Damian 2014-03-17 18:39:46 UTC
Fixing this would mean to break compatibility with the existing data builds.

The reason is that the system orders the outcomes based on the numeric values assigned to different tags. If we change the values, prior data will not make sense anymore.

Please advise.
Comment 5 Belen Barros Pena 2014-03-18 14:18:36 UTC
(In reply to comment #4)
> Fixing this would mean to break compatibility with the existing data builds.
> 
> The reason is that the system orders the outcomes based on the numeric
> values assigned to different tags. If we change the values, prior data will
> not make sense anymore.

This is what I guessed, but the problem is, as it behaves now it makes no sense, and the longer we wait to solve this problem the worse the impact of breaking the compatibility with previous data will get. 

We probably have no users right now outside of the people contributing, so now is the right time to make a change like this.

I've cc'ed Paul and David: it would be good to see what you guys think.

Thanks!


> 
> Please advise.
Comment 6 Paul Eggleton 2014-03-18 14:32:23 UTC
Hacking the data values to influence sorting seems like the wrong solution to me. If the values do not sort correctly then the answer is to add something else to the database so you can influence the sort order.
Comment 7 Belen Barros Pena 2014-03-28 10:25:47 UTC
We have the same problem with the "Cache attempt" column, by the way, where Failed will appear after File not in cache in the A to Z sorting.
Comment 8 David Reyna 2014-03-31 05:54:14 UTC
The only general solution I can think of without polluting the database, is to 

  (a) hide the 'real' ordeby value for the normal query processing

  (a) right before the pagination (since that is when the table is instantiated anyway), dynamically create a new virtual column with the text string values of the numerical field(s) and explicitly "orderby" this synthetic column.

That way we get a custom sort, and not much overhead.
Comment 9 David Reyna 2014-04-14 02:52:48 UTC
I have completed 5921 for both the "Outcome" and the "Cache attempt" columns.

This used the technique of a python class ‘property’ as a ‘field’ together with an explicit python sort (instead of ‘sortby’), as described in this web site. This general method can be used for any transient or synthesized value of a class instance.

    http://blog.mattwoodward.com/2013/02/generating-and-sorting-on-transient.html

This patch handles both forward and reverse sorts, plus it handles the ‘-1’ base for the outcome text table and the convention of using a blank string for sstate_cache values of SSTATE_NA.