Commit 372c6a54 authored by Michal Čihař's avatar Michal Čihař

Fix stats for languages with no strings (but existing translation) (issue #40)

parent 99b4681d
......@@ -158,4 +158,6 @@ class Language(models.Model):
def get_translated_percent(self):
from weblate.trans.models import Translation
translations = Translation.objects.filter(language = self).aggregate(Sum('translated'), Sum('total'))
if translations['total__sum'] == 0:
return 0
return round(translations['translated__sum'] * 100.0 / translations['total__sum'], 1)
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