Commit db1f0a4d authored by Michal Čihař's avatar Michal Čihař

Filtering for all source checks

parent 68e988b0
......@@ -172,7 +172,7 @@ class UnitManager(models.Manager):
project = translation.subproject.project)
sugs = sugs.values_list('checksum', flat = True)
return self.filter(checksum__in = sugs)
elif rqtype in CHECKS or rqtype == 'allchecks':
elif rqtype in CHECKS or rqtype in ['allchecks', 'sourcechecks']:
# Filter checks for current project
checks = Check.objects.filter(
......@@ -183,6 +183,8 @@ class UnitManager(models.Manager):
# Filter by language
if rqtype == 'allchecks':
checks = checks.filter(language = translation.language)
elif rqtype == 'sourcechecks':
checks = checks.filter(language = None)
elif CHECKS[rqtype].source and check_obj.target:
checks = checks.filter(
Q(language = translation.language) | Q(language = None)
......@@ -193,7 +195,7 @@ class UnitManager(models.Manager):
checks = checks.filter(language = translation.language)
# Filter by check type
if rqtype != 'allchecks':
if not rqtype in ['allchecks', 'sourcechecks']:
checks = checks.filter(check = rqtype)
checks = checks.values_list('checksum', flat = True)
......
......@@ -1790,6 +1790,9 @@ class Translation(models.Model):
Returns list of failing source checks on current subproject.
'''
result = [('all', _('All strings'))]
sourcechecks = self.unit_set.count_type('sourcechecks', self)
if sourcechecks > 0:
result.append(('sourcechecks', _('Strings with any failing checks (%d)') % sourcechecks))
return result
def get_translation_checks(self):
......
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