Stats for subprojects
This commit is contained in:
parent
830015769c
commit
e792bacaad
@ -11,10 +11,24 @@
|
|||||||
|
|
||||||
<h2>{% trans "Subprojects" %}</h2>
|
<h2>{% trans "Subprojects" %}</h2>
|
||||||
|
|
||||||
<ul>
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{% trans "Project" %}</th>
|
||||||
|
<th colspan="2">{% trans "Translated" %}</th>
|
||||||
|
</tr>
|
||||||
|
<tbody>
|
||||||
{% for prj in object.subproject_set.all %}
|
{% for prj in object.subproject_set.all %}
|
||||||
<li><a href="{{ prj.get_absolute_url }}">{{ prj.name }}</a></li>
|
{% with prj.get_translated_percent as percent %}
|
||||||
|
<tr>
|
||||||
|
<th><a href="{{ prj.get_absolute_url }}">{{ prj.name }}</a></th>
|
||||||
|
<td class="percent">{{ percent }}%</td>
|
||||||
|
<td class="progress"><div class="progress" id="{{ percent|floatformat:0 }}"></div></td>
|
||||||
|
</tr>
|
||||||
|
{% endwith %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -185,6 +185,10 @@ class SubProject(models.Model):
|
|||||||
|
|
||||||
self.create_translations()
|
self.create_translations()
|
||||||
|
|
||||||
|
def get_translated_percent(self):
|
||||||
|
translations = self.translation_set.aggregate(Sum('translated'), Sum('total'))
|
||||||
|
return round(translations['translated__sum'] * 100.0 / translations['total__sum'], 1)
|
||||||
|
|
||||||
class Translation(models.Model):
|
class Translation(models.Model):
|
||||||
subproject = models.ForeignKey(SubProject)
|
subproject = models.ForeignKey(SubProject)
|
||||||
language = models.ForeignKey(Language)
|
language = models.ForeignKey(Language)
|
||||||
|
Loading…
Reference in New Issue
Block a user