Last Comment Bug 470214 - Query sorting by multiple columns sometimes loses a column
: Query sorting by multiple columns sometimes loses a column
Status: RESOLVED FIXED
[3.4 only; 3.6 fixed by bug 164009]
: regression
Product: Bugzilla
Classification: Server Software
Component: Query/Bug List (show other bugs)
: 3.2
: All All
: -- minor with 1 vote (vote)
: Bugzilla 3.4
Assigned To: Frédéric Buclin
: default-qa
Mentors:
Depends on: 23473 164009 510944
Blocks:
  Show dependency treegraph
 
Reported: 2008-12-18 06:25 PST by Matt McHenry
Modified: 2010-02-04 14:30 PST (History)
3 users (show)
LpSolit: approval3.4+
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch, v1 (1.02 KB, patch)
2010-01-25 11:37 PST, Frédéric Buclin
gregaryh: review+
Details | Diff | Splinter Review

Description Matt McHenry 2008-12-18 06:25:50 PST
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5
Build Identifier: 

I normally like to sort first by prio, then by sev, then by component, and finally by summary.  So I just click those column headings in the reverse order.  This prepends the following to my LASTORDER cookie in 3.0.3:

bugs.priority%2Cbugs.bug_severity%2Cmap_components.name%2Cbugs.short_desc

In 3.2, after clicking the column headings for summary, component, and severity, my LASTORDER cookie starts with:

bugs.bug_severity%2Cmap_components.name%2Cbugs.short_desc

If I then click the priority heading, the severity sort key gets lost:

bugs.priority%2Cmap_components.name%2Cbugs.short_desc

Reproducible: Always




Initially reported in bug 164009 comment 16.
Comment 1 Teemu Mannermaa (:wicked) 2009-01-12 01:13:23 PST
I can confirm this happening in current trunk verison. There's some funky things going on with the order parameter when there's multiple order columns. Same funkiness can be seen on the URL order param, which then gets stored in LASTORDER cookie.

I have a feeling that this might get fixed by the patch in bug 164009 but we'll see.
Comment 2 Teemu Mannermaa (:wicked) 2009-05-06 19:17:38 PDT
This is caused by a regression introduced by 23473 since it eagerly modifies the global order variable when using order.remove() to remove duplicate columns. This then affects rest of the columns after the first column from the current sort order.

As I suspected this is fixed by the latest patch in bug 164009.
Comment 3 Frédéric Buclin 2009-08-21 06:03:37 PDT
(In reply to comment #2)
> As I suspected this is fixed by the latest patch in bug 164009.

The relevant part of this patch, which I suppose is the regexp, has been fixed separately in bug 510944, so I'm pretty sure this is now fixed in Bugzilla 3.4.2.
Comment 4 Matt McHenry 2009-12-01 13:51:41 PST
This is still not working in 3.4.4+, but is fixed on trunk.  I don't have permission to change the target milestone, and I'm not sure whether this warrants a reopen for further work on the 3.4 branch, so I'll let others decide how to handle it.

Running the query https://landfill.bugzilla.org/bugzilla-3.4-branch/buglist.cgi?query_format=advanced&bug_status=ASSIGNED&product=FoodReplicator and using http://addneditcookies.mozdev.org/ to look at my cookies, I see:

0. COLUMNLIST=bug_severity%20priority%20assigned_to_realname%20bug_status%20resolution%20component%20target_milestone%20status_whiteboard%20keywords%20short_desc
1. LASTORDER=bug_id
2. click the "summary" header
3. LASTORDER=short_desc%2Cbug_id
4. click the "comp" header
5. LASTORDER=component%2Cshort_desc%2Cbug_id
6. click the "sev" header
7. LASTORDER=bug_severity%2Ccomponent%2Cshort_desc%2Cbug_id
8. click the "pri" header
9. LASTORDER=priority%2Ccomponent%2Cshort_desc%2Cbug_id

On https://landfill.bugzilla.org/bugzilla-tip, I instead see:
...
9. LASTORDER=priority%2Cbug_severity%2Ccomponent%2Cshort_desc%2Cbug_id
Comment 5 Christian Schlotter 2010-01-25 08:32:04 PST
> (In reply to comment #2)
> The relevant part of this patch, which I suppose is the regexp, has been fixed
> separately in bug 510944, so I'm pretty sure this is now fixed in Bugzilla
> 3.4.2.

@Frédéric:
Please reopen this bug as it is definitely not fixed in Bugzilla 3.4.4+ (also see comment 4). Comparing the order parameter in the URL on four different Bugzilla versions after clicking Pri, Sev, Assignee:

OK:
Bugzilla 3.0.10+ (https://landfill.bugzilla.org/bugzilla-3.0-branch/):
order=map_assigned_to.login_name%2Cbugs.priority%2Cbugs.bug_severity

Not OK:
Bugzilla 3.2.5+ (https://landfill.bugzilla.org/bugzilla-3.2-branch/):
order=map_assigned_to.login_name desc%2Cbugs.bug_status%2Cbugs.bug_id

Not OK:
Bugzilla 3.4.4+ (https://landfill.bugzilla.org/bugzilla-3.4-branch/):
order=assigned_to DESC%2Cbug_status%2Cbug_id

OK:
Bugzilla 3.5.2+ (https://landfill.bugzilla.org/bugzilla-tip/)
order=assigned_to%2Cpriority%2Cbug_severity%2Cbug_status%2Cbug_id
Comment 6 Frédéric Buclin 2010-01-25 11:35:50 PST
OK, you're right; this bug is not fixed on the 3.4 branch. 3.5.2 is not affected thanks to bug 164009. I have a patch for 3.4.5.
Comment 7 Frédéric Buclin 2010-01-25 11:37:48 PST
Created attachment 423381 [details] [diff] [review]
patch, v1

We must not replace $order by its trimmed value. This patch is similar to what has been done upstream. wicked: this patch is for the 3.4 branch only, see my previous comment.
Comment 8 Frédéric Buclin 2010-02-04 14:30:35 PST
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/3.4/
modified template/en/default/list/table.html.tmpl
Committed revision 6719.

Note You need to log in before you can comment on or make changes to this bug.