euscanwww: misc fixes

Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
This commit is contained in:
Corentin Chary 2012-08-03 21:58:24 +02:00
parent d0aceaeec4
commit 94f6b7541c
3 changed files with 16 additions and 13 deletions

View File

@ -145,13 +145,13 @@ class Version(models.Model):
def cpv(self):
return '%s/%s-%s%s' % (
self.package.category, self.package.name, self.version,
self.revision if self.revision != '-r0' else ''
'-' + self.revision if self.revision != '-r0' else ''
)
def __unicode__(self):
return '%s/%s-%s%s:%s [%s]' % (
self.package.category, self.package.name, self.version,
self.revision if self.revision != '-r0' else '',
'-' + self.revision if self.revision != '-r0' else '',
self.slot, self.overlay or "<upstream>"
)

View File

@ -24,7 +24,7 @@
Hot categories:
<ul>
{% for c in categories|slice:":3" %}
<li><a href="{% url "category" c.category %}">{{ c.category }}</a> ({{ c.n_versions|sub:c.n_packaged }})</li>
<li><a href="{% url "category" c.category %}">{{ c.category }}</a> ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }})</li>
{% endfor %}
</ul>
</li>
@ -43,7 +43,7 @@
Hot herds:
<ul>
{% for c in herds|slice:":3" %}
<li><a href="{% url "herd" c.herds__herd %}">{{ c.herds__herd }}</a> ({{ c.n_versions|sub:c.n_packaged }})</li>
<li><a href="{% url "herd" c.herds__herd %}">{{ c.herds__herd }}</a> ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }})</li>
{% endfor %}
</ul>
</li>
@ -65,7 +65,7 @@
Hot maintainers:
<ul>
{% for c in maintainers|slice:":3" %}
<li><a href="{% url "maintainer" c.maintainers__id %}">{{ c.maintainers__name }}</a> ({{ c.n_versions|sub:c.n_packaged }})</li>
<li><a href="{% url "maintainer" c.maintainers__id %}">{{ c.maintainers__name }}</a> ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }})</li>
{% endfor %}
</ul>
</li>
@ -84,7 +84,7 @@
Hot packages:
<ul>
{% for c in packages|slice:":3" %}
<li><a href="{% url "package" c.category c.name %}">{{ c }}</a> ({{ c.n_versions|sub:c.n_packaged }})</li>
<li><a href="{% url "package" c.category c.name %}">{{ c }}</a> ({{ c.n_versions|sub:c.n_packaged|sub:c.n_overlay }})</li>
{% endfor %}
</ul>
</li>

View File

@ -377,28 +377,31 @@ def refresh_package(request, category, package):
if not created:
obj.priority += 1
obj.save()
if created:
from djeuscan.tasks import consume_refresh_queue
consume_refresh_queue.delay()
return {"result": "success", "position": obj.position}
@login_required
@render_to('euscan/accounts/index.html')
def accounts_index(request):
user = request.user
upstream_k = lambda c: c["n_versions"] - c["n_packaged"]
upstream_k = lambda c: c["n_versions"] - c["n_packaged"] - c["n_overlay"]
categories = sorted(get_account_categories(user),
key=upstream_k, reverse=True)
c_upstream = sum([c["n_versions"] - c["n_packaged"] for c in categories])
c_upstream = sum([upstream_k(c) for c in categories])
herds = sorted(get_account_herds(request.user),
key=upstream_k, reverse=True)
h_upstream = sum([c["n_versions"] - c["n_packaged"] for c in herds])
h_upstream = sum([upstream_k(c) for c in herds])
maintainers = sorted(get_account_maintainers(request.user),
key=upstream_k, reverse=True)
m_upstream = sum([c["n_versions"] - c["n_packaged"] for c in maintainers])
m_upstream = sum([upstream_k(c) for c in maintainers])
packages = sorted(get_profile(user).packages.all(),
key=lambda p: p.n_versions - p.n_packaged, reverse=True)
p_upstream = sum([c.n_versions - c.n_packaged for c in packages])
key=lambda p: p.n_versions - p.n_packaged - p.n_overlay, reverse=True)
p_upstream = sum([c.n_versions - c.n_packaged - c.n_overlay for c in packages])
return {
"categories": categories, "categories_upstream": c_upstream,
"herds": herds, "herds_upstream": h_upstream,