← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~adeuring/launchpad/bug-sorting into lp:launchpad

 

Abel Deuring has proposed merging lp:~adeuring/launchpad/bug-sorting into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~adeuring/launchpad/bug-sorting/+merge/82217

This branch allows to sort bug searches results by milestone name.
(part of https://dev.launchpad.net/LEP/CustomBugListings)

This is basically a boilerplate addition of another entry to
the dictionary BugTaskSet._ORDERBY_COLUMN, which maps query strings
specifying the order to table columns.

Since the milestone table is normally not included in the FROM clause
of an SQL query, I added slightly more complex data to this dictionary:
Aside from the sort expression, the entry for "milestone_name" contains
also the class Milestone itself and a LeftJoin. This data is used to
include the join in the list join_tables, which in turn used to build
the FROM clause.

I also explicitly added a "second order" sorting, since milestones are
not the most fine grained sort option: By default, the "second level
sort order" would be bug.id or bugtask.id (depending on the search target),
and this is in many use cases probably not very helpful.

test:

./bin/test bugs -vvt test_bugtask_search.*test_sort_by_milestone_name

no lint

-- 
https://code.launchpad.net/~adeuring/launchpad/bug-sorting/+merge/82217
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~adeuring/launchpad/bug-sorting into lp:launchpad.