Closed Bug 148157 Opened 23 years ago Closed 23 years ago

Bad sorting in describecomponents.cgi

Categories

(Bugzilla :: User Interface, defect)

2.16
x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.16

People

(Reporter: dkl, Assigned: myk)

Details

(Keywords: regression)

Attachments

(1 file)

describecomponents.cgi sorts improperly. I noticed this after importing our bugzilla database (RH) into the new 2.16 code base. I have a list of several hundred components. There is already an "ORDER BY value" clause in the SELECT statement in describecomponents.cgi that does sorting for you. For some reason the extra sort in the template file components.html.tmpl is causing wierd things with the array reference to the components. Probably has something to with the components array being an array of hash refs. Anyway, removing the sort from the FOR component = components.sort allows the components to display in proper order. Attaching patch fixing problem.
Adding template author to cc list.
Comment on attachment 85608 [details] [diff] [review] Sorting fix for describecomponents.cgi (v1) I wonder what the sort key used in that comparison truly is... Well, the patch fixes this anyway, and there's no need to do double sorting anyway. r=jouni
Attachment #85608 - Flags: review+
Comment on attachment 85608 [details] [diff] [review] Sorting fix for describecomponents.cgi (v1) >Index: template/en/default/reports/components.html.tmpl >=================================================================== >RCS file: /cvsroot/mozilla/webtools/bugzilla/template/en/default/reports/components.html.tmpl,v >retrieving revision 1.4.2.1 >diff -u -u -r1.4.2.1 components.html.tmpl >--- template/en/default/reports/components.html.tmpl 23 May 2002 08:14:25 -0000 1.4.2.1 >+++ template/en/default/reports/components.html.tmpl 30 May 2002 16:09:56 -0000 >@@ -51,7 +51,7 @@ > [% END %] > </tr> > >- [% FOREACH comp = components.sort %] >+ [% FOREACH comp = components %] > [% INCLUDE describe_comp %] > [% END %] > <tr> The "sort" pseudo-method sorts in alphabetical order (or perhaps in ASCII code order, although the docs don't mention it). In this case the array stores hashes which get converted to scalars in the sort function (either to numeric 1 or to strings like "HASH(0xFE35A5B)"), so the sort doesn't work. If we had to, we could define our own sort function that peered into the hashes and sorted by the values of one of their keys, but fortunately we have ORDER BY in the query. r=myk
Attachment #85608 - Flags: review+
cvs commit -m "Fix for bug 148157 - Bad sorting in describecomponents.cgi, patch by David Lawrence <dkl@redhat.com> r=jouni@heikniemi.net,myk@mozilla.org" BUGZILLA-2_16-BRANCH template/en/default/reports/components.html.tmpl Checking in template/en/default/reports/components.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/reports/components.html.tmpl,v <-- components.html.tmpl new revision: 1.4.2.2; previous revision: 1.4.2.1 done HEAD Checking in template/en/default/reports/components.html.tmpl; /cvsroot/mozilla/webtools/bugzilla/template/en/default/reports/components.html.tmpl,v <-- components.html.tmpl new revision: 1.6; previous revision: 1.5 done
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Yeah, originally it was just teh component, then it was changed to a hash for some reason I can't recall ATM.
Keywords: regression
Target Milestone: --- → Bugzilla 2.16
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: