summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-04-17 18:10:26 +0200
committerDan McGee <dan@archlinux.org>2010-04-17 18:10:26 +0200
commitad33813bc14621911ea057b0143493a99048f4cb (patch)
tree02d1f455fd1d2c9b90b89ace2afffbd23ffbf574 /public
parent8ea4aa21d15138461f5ebb8387c595ad8314828a (diff)
downloadarchweb-ad33813bc14621911ea057b0143493a99048f4cb.tar.gz
archweb-ad33813bc14621911ea057b0143493a99048f4cb.tar.xz
Improve front page recent updates list
Instead of linking the package name, link the architecture. This will prevent the lost links we had when we collapsed the list to show multiple architectures at the same time. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'public')
-rw-r--r--public/utils.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/public/utils.py b/public/utils.py
index f4418d1..88f073d 100644
--- a/public/utils.py
+++ b/public/utils.py
@@ -8,12 +8,19 @@ def get_recent_updates():
for a in Arch.objects.all():
# grab a few extra so we can hopefully catch everything we need
pkgs += list(Package.objects.select_related('arch', 'repo').filter(arch=a).order_by('-last_update')[:50])
- pkgs.sort(reverse=True, key=lambda q: q.last_update)
- for p in pkgs:
+ pkgs.sort(key=lambda q: q.last_update)
+ updates = []
+ ctr = 0
+ while ctr < 15 and len(pkgs) > 0:
+ # not particularly happy with this logic, but it works.
+ p = pkgs.pop()
samepkgs = filter(lambda q: p.is_same_version(q) and p.repo == q.repo, pkgs)
- p.allarches = '/'.join(sorted([q.arch.name for q in samepkgs]))
+ samepkgs.append(p)
+ samepkgs.sort(key=lambda q: q.arch.name)
+ updates.append(samepkgs)
for q in samepkgs:
if p != q: pkgs.remove(q)
- return pkgs[:15]
+ ctr += 1
+ return updates
# vim: set ts=4 sw=4 et: