Closed Bug 148157 Opened 22 years ago Closed 22 years ago
Bad sorting in describecomponents
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
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 184.108.40.206 >diff -u -u -r220.127.116.11 components.html.tmpl >--- template/en/default/reports/components.html.tmpl 23 May 2002 08:14:25 -0000 18.104.22.168 >+++ 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
cvs commit -m "Fix for bug 148157 - Bad sorting in describecomponents.cgi, patch by David Lawrence <firstname.lastname@example.org> email@example.com,firstname.lastname@example.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: 22.214.171.124; previous revision: 126.96.36.199 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: 22 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.
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.