From 8f85fe67d4749c838778e11b442d6cb3d6145889 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 30 Apr 2012 22:17:31 +0200 Subject: [PATCH] Revert sorting build products Sorting the build products list fails if there are fewer than 3 build products. This is because of extreme Template Toolkit brain damage: it treats arrays of 0-2 elements differently in some magic way. See e.g. http://mail.template-toolkit.org/pipermail/templates/2011-April/011510.html --- src/root/product-list.tt | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/root/product-list.tt b/src/root/product-list.tt index 5017f03d..64c60417 100644 --- a/src/root/product-list.tt +++ b/src/root/product-list.tt @@ -2,13 +2,9 @@ [% BLOCK renderProductList -%] - [% # Work around a strange bug: build.buildproducts.size returns 3 when the actual size is 1. - nrProducts = 0; FOREACH product IN build.buildproducts; nrProducts = nrProducts + 1; END - %] - - [% FOREACH product IN build.buildproducts.nsort('productnr') -%] + [% FOREACH product IN build.buildproducts -%] [% uri = "${c.uri_for('/build' build.id 'download' product.productnr)}" _ (product.name ? "/" _ product.name : "") @@ -143,7 +139,7 @@
Links to latest: - [% IF nrProducts > 1 %] + [% IF build.buildproducts.count > 1 %] [% uri2 = "${c.uri_for(latestRoot.join('/') 'download-by-type' product.type product.subtype)}" %] [% uri2 %]
@@ -210,7 +206,7 @@
- Something of type [% product.type %] + Something of type [% product.type %] [% product %]