Commit 7b16bb13 authored by Michal Čihař's avatar Michal Čihař

Show strings with suggestions

parent 69b02bda
......@@ -42,9 +42,18 @@ class UnitManager(models.Manager):
return dbunit
def filter_type(self, rqtype):
import trans.models
if rqtype == 'all':
return self.all()
elif rqtype == 'fuzzy':
return self.filter(fuzzy = True)
elif rqtype == 'untranslated':
return self.filter(translated = False)
elif rqtype == 'suggestions':
sample = self.all()[0]
sugs = trans.models.Suggestion.objects.filter(
language = sample.translation.language,
project = sample.translation.subproject.project)
sugs = sugs.values_list('checksum', flat = True)
return self.filter(checksum__in = sugs)
......@@ -318,10 +318,13 @@ class Translation(models.Model):
result = []
nottranslated = self.unit_set.filter_type('untranslated').count()
fuzzy = self.unit_set.filter_type('fuzzy').count()
suggestions = self.unit_set.filter_type('suggestions').count()
if nottranslated > 0:
result.append(('untranslated', _('Not translated strings (%d)') % nottranslated))
if fuzzy > 0:
result.append(('fuzzy', _('Fuzzy strings (%d)') % fuzzy))
if suggestions > 0:
result.append(('suggestions', _('Strings with suggestions (%d)') % suggestions))
return result
......
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