Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
Revert "switch the stats urls (bug 697474)"
Browse files Browse the repository at this point in the history
This reverts commit 034c3b4.
  • Loading branch information
Jeff Balogh committed Oct 27, 2011
1 parent 2dd4b3c commit 6704253
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
6 changes: 4 additions & 2 deletions apps/addons/templates/addons/details_box.html
Expand Up @@ -83,7 +83,8 @@
<strong class="downloads">{{
addon.total_downloads|numberfmt }}</strong>
{% if addon.public_stats %}
<a href="{{ url('stats.overview', addon.slug) }}">
{# TODO real reverse URL #}
<a href="{{ locale_url('/statistics/addon/{0}'|f(addon.id)) }}">
{{ _('View Statistics') }}</a>
{% endif %}
</td>
Expand All @@ -95,7 +96,8 @@
<strong class="downloads">{{
addon.average_daily_users|numberfmt }}</strong>
{% if addon.public_stats %}
<a href="{{ url('stats.overview', addon.slug) }}">
{# TODO real reverse URL #}
<a href="{{ locale_url('/statistics/addon/{0}'|f(addon.id)) }}">
{{ _('View Statistics') }}</a>
{% endif %}
</td>
Expand Down
16 changes: 9 additions & 7 deletions apps/addons/templates/addons/impala/details.html
Expand Up @@ -29,13 +29,15 @@
{% set adu = addon.average_daily_users %}
{% if adu %}
<div id="daily-users">
{% with num_users = ngettext('{0} user', '{0} users', adu)|f(adu|numberfmt) %}
{% if addon.public_stats %}
<a class="stats" title="{{ _('View statistics') }}" href="{{ url('stats.overview', addon.slug) }}">{{ num_users }}</a>
{% else %}
{{ num_users }}
{% endif %}
{% endwith %}
{% set stats = addon.public_stats %}
{% if stats %}
{# TODO real reverse URL #}
<a class='stats' title='View statistics' href="{{ locale_url('/statistics/addon/{0}'|f(addon.id)) }}">
{% endif %}
{{ ngettext('{0} user', '{0} users', adu)|f(adu|numberfmt) }}
{% if stats %}
</a>
{% endif %}
</div>
{% endif %}

Expand Down
Expand Up @@ -40,7 +40,8 @@ <h5>{{ _('Actions') }}</h5>
{% endif %}
{% if not addon.disabled_by_user %}
<li>
<a href="{{ url('stats.overview', addon.slug) }}" class="tooltip"
<a href="{{ locale_url('/statistics/addon/{0}')|f(addon.id) }}" class="tooltip"
{# <a href="{{ url('stats.overview', addon.slug) }}" class="tooltip" #}
title="{{ _('Daily statistics on downloads and users.') }}">
{{ _('Statistics') }}</a>
</li>
Expand Down
3 changes: 2 additions & 1 deletion apps/devhub/templates/devhub/includes/addons_edit_nav.html
Expand Up @@ -19,7 +19,8 @@ <h3>{{ addon.name }}</h3>
{{ _('View Add-on Listing') }}</a></li>
<li><a href="{{ url('devhub.feed', addon.slug) }}">
{{ _('View Recent Changes') }}</a></li>
<li><a href="{{ url('stats.overview', addon.slug) }}">
<li><a href="{{ locale_url('/statistics/addon/{0}')|f(addon.id) }}">
{# <li><a href="{{ url('stats.overview', addon.slug) }}"> #}
{{ _('View Statistics Dashboard') }}</a></li>
</ul>
</div>
Expand Down
6 changes: 3 additions & 3 deletions apps/stats/helpers.py
Expand Up @@ -5,7 +5,7 @@
from jingo import register, env
from tower import ugettext as _
from access import acl
from amo.urlresolvers import reverse
from amo.helpers import locale_url


@register.inclusion_tag('stats/report_menu.html')
Expand Down Expand Up @@ -73,10 +73,10 @@ def report_menu(context, request, addon, report):
'title': _('Contributions')
})

base_url = reverse('stats.overview', args=[addon.slug])
base_url = '/addon/%d/statistics' % (addon.id)

"""Reports Menu. navigation for the various statistic reports."""
c = {'report': report,
'base_url': base_url,
'base_url': locale_url(base_url),
'report_tree': report_tree}
return c
9 changes: 9 additions & 0 deletions apps/stats/models.py
Expand Up @@ -66,6 +66,9 @@ class DownloadCount(SearchMixin, models.Model):
class Meta:
db_table = 'download_counts'

def flush_urls(self):
return ['*/addon/%d/statistics/downloads*' % self.addon_id, ]


class UpdateCount(SearchMixin, models.Model):
addon = models.ForeignKey('addons.Addon')
Expand All @@ -85,6 +88,9 @@ class UpdateCount(SearchMixin, models.Model):
class Meta:
db_table = 'update_counts'

def flush_urls(self):
return ['*/addon/%d/statistics/usage*' % self.addon_id, ]


class AddonShareCount(caching.base.CachingMixin, models.Model):
addon = models.ForeignKey('addons.Addon')
Expand Down Expand Up @@ -178,6 +184,9 @@ class Meta:
def __unicode__(self):
return u'%s: %s' % (self.addon.name, self.amount)

def flush_urls(self):
return ['*/addon/%d/statistics/contributions*' % self.addon_id, ]

@property
def date(self):
try:
Expand Down

0 comments on commit 6704253

Please sign in to comment.