Show two significant digits for response rate %. [bug 617109]

This commit is contained in:
Ricky Rosario 2010-12-07 10:53:31 -05:00
Родитель 956f198cdd
Коммит 13f4f96396
2 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -58,7 +58,7 @@
{% else %}
<div class="bubble">
<div class="perc">
<span class="data">{{ activity_stats[0][1]['perc'] }}</span>%
<span class="data">{% if activity_stats[0][1]['perc'] < 10 %}{{ activity_stats[0][1]['perc']|round(1) }}{% else %}{{ activity_stats[0][1]['perc']|round(0)|int }}{% endif %}</span>%
<span class="label">of tweets</span>
</div>
<div class="numbers">
@ -76,7 +76,7 @@
<select>
{% for act in activity_stats %}
<option value="{{ loop.index0 }}"
data-perc ="{{ act[1]['perc'] }}"
data-perc ="{% if act[1]['perc'] < 10 %}{{ act[1]['perc']|round(1) }}{% else %}{{ act[1]['perc']|round(0)|int }}{% endif %}"
data-replies="{{ act[1]['replies'] }}"
data-requests="{{ act[1]['requests'] }}">
{{ act[0] }}

Просмотреть файл

@ -89,7 +89,7 @@ def landing(request):
activity_stats.append((act[0], {
'requests': format_number(act[1], locale='en_US'),
'replies': format_number(act[2], locale='en_US'),
'perc': int(round(act[3] * 100)),
'perc': act[3] * 100,
}))
else:
activity_stats = None