[damned-lies] Show visual module stats in translator profile (fixes #674607)
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Show visual module stats in translator profile (fixes #674607)
- Date: Tue, 9 Oct 2012 13:43:10 +0000 (UTC)
commit 8c475807abf343d5dd390526054a3fcd04a2911d
Author: Claude Paroz <claude 2xlibre net>
Date: Tue Oct 9 15:41:25 2012 +0200
Show visual module stats in translator profile (fixes #674607)
Thanks Daniel Mustieles for the suggestion.
stats/templatetags/stats_extras.py | 4 +++-
templates/people/person_detail.html | 6 ++++--
vertimus/models.py | 4 ++++
3 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/stats/templatetags/stats_extras.py b/stats/templatetags/stats_extras.py
index f481bc4..efc8710 100644
--- a/stats/templatetags/stats_extras.py
+++ b/stats/templatetags/stats_extras.py
@@ -103,8 +103,10 @@ def vis_stats(stat, scope='full'):
trans, fuzzy, untrans = stat.tr_percentage(scope), stat.fu_percentage(scope), stat.un_percentage(scope)
elif isinstance(stat, PoFile):
trans, fuzzy, untrans = stat.tr_percentage(), stat.fu_percentage(), stat.un_percentage()
- else:
+ elif isinstance(stat, dict):
trans, fuzzy, untrans = stat['translated_perc'], stat['fuzzy_perc'], stat['untranslated_perc']
+ else:
+ return ""
return mark_safe("""
<div class="translated" style="width: %(trans)spx;"></div>
<div class="fuzzy" style="%(dir)s:%(trans)spx; width:%(fuzzy)spx;"></div>
diff --git a/templates/people/person_detail.html b/templates/people/person_detail.html
index 5e1b00d..c90f5af 100644
--- a/templates/people/person_detail.html
+++ b/templates/people/person_detail.html
@@ -10,7 +10,8 @@ $(document).ready(function()
{
$("#working_on").tablesorter({
headers: {
- 0: { sorter:'text' }
+ 0: { sorter:'text' },
+ 2: { sorter:false }
},
sortList: [[0,0]] });
}
@@ -51,13 +52,14 @@ $(document).ready(function()
<table class="stats" id="working_on">
<thead><tr>
- <th>{% trans "Date" %}</th><th>{% trans "Module" %}</th><th>{% trans "State" %}</th>
+ <th>{% trans "Date" %}</th><th>{% trans "Module" %}</th><th></th><th>{% trans "State" %}</th>
</tr></thead>
<tbody>
{% for state in states %}
<tr>
<td><span style="display: none;">{{ state.updated|date:"c" }}</span>{{ state.updated|naturalday:"DATE_FORMAT" }}</td>
<td><a href="{{ state.get_absolute_url }}">{{ state.branch.module.get_description }} - {{ state.branch.name }} - {{ state.domain.get_description }} - {{ state.language.get_name }}</a></td>
+ <td><div class="graph">{{ state.stats|vis_stats }}</div></td>
<td>{{ state.description }}</td>
</tr>
{% endfor %}
diff --git a/vertimus/models.py b/vertimus/models.py
index 65a4836..57e1d5a 100644
--- a/vertimus/models.py
+++ b/vertimus/models.py
@@ -83,6 +83,10 @@ class State(models.Model):
def get_absolute_url(self):
return ('vertimus_by_ids', [self.branch.id, self.domain.id, self.language.id])
+ @property
+ def stats(self):
+ return Statistics.objects.get(branch=self.branch, domain=self.domain, language=self.language)
+
def change_state(self, state_class, person=None):
self.name = state_class.name
self.person = person
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]