Commit 9937cf64 authored by Michal Čihař's avatar Michal Čihař

Migrate source string checklist to new class

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 853eb810
...@@ -927,47 +927,41 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin): ...@@ -927,47 +927,41 @@ class Translation(models.Model, URLMixin, PercentMixin, LoggerMixin):
''' '''
Returns list of failing source checks on current subproject. Returns list of failing source checks on current subproject.
''' '''
result = [ result = TranslationChecklist()
( result.add(
'all', 'all',
_('All strings'), _('All strings'),
self.total, self.total,
'success', 'success',
) )
]
# All checks # All checks
sourcechecks = self.unit_set.count_type('sourcechecks', self) result.add_if(
if sourcechecks > 0:
result.append((
'sourcechecks', 'sourcechecks',
_('Strings with any failing checks'), _('Strings with any failing checks'),
sourcechecks, self.unit_set.count_type('sourcechecks', self),
'danger', 'danger',
)) )
# Process specific checks # Process specific checks
for check in CHECKS: for check in CHECKS:
if not CHECKS[check].source: check_obj = CHECKS[check]
if not check_obj.source:
continue continue
cnt = self.unit_set.count_type(check, self) result.add_if(
if cnt > 0:
result.append((
check, check,
CHECKS[check].description, check_obj.description,
cnt, self.unit_set.count_type(check, self),
CHECKS[check].severity, check_obj.severity,
)) )
# Grab comments # Grab comments
sourcecomments = self.unit_set.count_type('sourcecomments', self) result.add_if(
if sourcecomments > 0:
result.append((
'sourcecomments', 'sourcecomments',
_('Strings with comments'), _('Strings with comments'),
sourcecomments, self.unit_set.count_type('sourcecomments', self),
'info', 'info',
)) )
return result 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