[damned-lies: 4/9] Show reduced stats in team page
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies: 4/9] Show reduced stats in team page
- Date: Wed, 16 Mar 2011 09:05:03 +0000 (UTC)
commit 1f138229fc6be8ea5459c18726a84d4c38f805eb
Author: Claude Paroz <claude 2xlibre net>
Date: Fri Mar 4 18:09:15 2011 +0100
Show reduced stats in team page
stats/models.py | 21 +++++++++++++++++----
templates/languages/language_release_summary.html | 18 ++++++++++++++----
templates/vertimus/vertimus_detail.html | 2 +-
3 files changed, 32 insertions(+), 9 deletions(-)
---
diff --git a/stats/models.py b/stats/models.py
index 14f2a4d..82677b2 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -916,8 +916,10 @@ class Release(models.Model):
total_doc, total_ui, total_ui_part = self.total_strings()
query = """
SELECT domain.dtype,
- SUM(pofile.translated),
- SUM(pofile.fuzzy)
+ SUM(pofull.translated) AS trans,
+ SUM(pofull.fuzzy),
+ SUM(popart.translated) AS trans_p,
+ SUM(popart.fuzzy) AS fuzzy_p
FROM statistics AS stat
LEFT JOIN domain
ON stat.domain_id = domain.id
@@ -925,8 +927,10 @@ class Release(models.Model):
ON stat.branch_id = branch.id
LEFT JOIN category
ON category.branch_id = branch.id
- LEFT JOIN pofile
- ON pofile.id = stat.full_po_id
+ LEFT JOIN pofile AS pofull
+ ON pofull.id = stat.full_po_id
+ LEFT JOIN pofile AS popart
+ ON popart.id = stat.part_po_id
WHERE language_id = %s
AND category.release_id = %s
GROUP BY domain.dtype"""
@@ -934,21 +938,30 @@ class Release(models.Model):
cursor.execute(query, (lang.id, self.id))
stats = {'id': self.id, 'name': self.name, 'description': _(self.description),
'uitrans': 0, 'uifuzzy': 0, 'uitotal': total_ui,
+ 'uitrans_part': 0, 'uifuzzy_part': 0, 'uitotal_part': total_ui_part,
'doctrans': 0, 'docfuzzy': 0, 'doctotal': total_doc,
'uitransperc': 0, 'uifuzzyperc': 0, 'uiuntransperc': 0,
+ 'uitransperc_part': 0, 'uifuzzyperc_part': 0, 'uiuntransperc_part': 0,
'doctransperc': 0, 'docfuzzyperc': 0, 'docuntransperc': 0}
for res in cursor.fetchall():
if res[0] == 'ui':
stats['uitrans'] = res[1]
stats['uifuzzy'] = res[2]
+ stats['uitrans_part'] = res[3]
+ stats['uifuzzy_part'] = res[4]
if res[0] == 'doc':
stats['doctrans'] = res[1]
stats['docfuzzy'] = res[2]
stats['uiuntrans'] = total_ui - (stats['uitrans'] + stats['uifuzzy'])
+ stats['uiuntrans_part'] = total_ui_part - (stats['uitrans_part'] + stats['uifuzzy_part'])
if total_ui > 0:
stats['uitransperc'] = int(100*stats['uitrans']/total_ui)
stats['uifuzzyperc'] = int(100*stats['uifuzzy']/total_ui)
stats['uiuntransperc'] = int(100*stats['uiuntrans']/total_ui)
+ if total_ui_part > 0:
+ stats['uitransperc_part'] = int(100*stats['uitrans_part']/total_ui_part)
+ stats['uifuzzyperc_part'] = int(100*stats['uifuzzy_part']/total_ui_part)
+ stats['uiuntransperc_part'] = int(100*stats['uiuntrans_part']/total_ui_part)
stats['docuntrans'] = total_doc - (stats['doctrans'] + stats['docfuzzy'])
if total_doc > 0:
stats['doctransperc'] = int(100*stats['doctrans']/total_doc)
diff --git a/templates/languages/language_release_summary.html b/templates/languages/language_release_summary.html
index 014a16e..be8fde1 100644
--- a/templates/languages/language_release_summary.html
+++ b/templates/languages/language_release_summary.html
@@ -6,15 +6,22 @@ Following variables should be set:
show_all_modules_line : boolean
{% endcomment %}
<table class="stats">
- <thead><tr><th>{% trans "Release" %}</th><th>{% trans "User Interface" %}</th><th>{% trans "Graph" %}</th>
- <th>{% trans "Documentation" %}</th><th>{% trans "Graph" %}</th></tr></thead>
+ <thead><tr>
+ <th>{% trans "Release" %}</th>
+ <th>{% trans "User Interface" %}</th>
+ <th>{% trans "Graph" %}</th>
+ <th>{% trans "User Interface (red.)" %}</th>
+ <th>{% trans "Documentation" %}</th>
+ <th>{% trans "Graph" %}</th>
+ </tr>
+ </thead>
{% for stat in stats %}
<tr>
<td class="leftcell">
{{ stat.description }}</a>
</td>
- <td><a href="{% url language_release lang.locale,stat.name,"ui" %}">
+ <td class="stats_numb"><a href="{% url language_release lang.locale,stat.name,"ui" %}">
{{ stat.uitransperc }}% ({{ stat.uitrans }}/{{ stat.uifuzzy }}/{{ stat.uiuntrans }})</a>
</td>
<td style="width: 108px; text-align: center;"><div class="graph">
@@ -25,9 +32,12 @@ Following variables should be set:
{% endwith %}
</div>
</td>
+ <td class="stats_numb"><a href="{% url language_release lang.locale,stat.name,"ui" %}">
+ {{ stat.uitransperc_part }}% ({{ stat.uitrans_part }}/{{ stat.uifuzzy_part }}/{{ stat.uiuntrans_part }})</a>
+ </td>
{% if stat.doctotal %}
- <td><a href="{% url language_release lang.locale,stat.name,"doc" %}">
+ <td class="stats_numb"><a href="{% url language_release lang.locale,stat.name,"doc" %}">
{{ stat.doctransperc }}% ({{ stat.doctrans }}/{{ stat.docfuzzy }}/{{ stat.docuntrans }})</a>
</td>
<td style="width: 108px; text-align: center;"><div class="graph">
diff --git a/templates/vertimus/vertimus_detail.html b/templates/vertimus/vertimus_detail.html
index 60c4206..30fb373 100644
--- a/templates/vertimus/vertimus_detail.html
+++ b/templates/vertimus/vertimus_detail.html
@@ -70,7 +70,7 @@ $(document).ready(function() {
<div class="untranslated" style="{{ LANGUAGE_BIDI|yesno:"right,left" }}:{{ stats.tr_percentage|add:stats.fu_percentage }}px; width: {{ stats.un_percentage }}px;"></div>
</div>
</div>
- {% if stats.part_po %}
+ {% if stats.part_po != stats.full_po %}
<div style="float:left; margin-left: 150px;">
<a href="{{ po_url_reduced }}"><img src="{{ MEDIA_URL }}img/download.png" alt="{% trans "Download PO file" %}" /></a> {% trans "Translated (reduced):" %}
{{ stats.get_reducedstat|safe }}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]