Commit 8c475807 authored by Claude Paroz's avatar Claude Paroz

Show visual module stats in translator profile (fixes #674607)

Thanks Daniel Mustieles for the suggestion.
parent a670a0ed
......@@ -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>
......
......@@ -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 %}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment