Commit 85d5ace6 authored by Michal Čihař's avatar Michal Čihař

Simplify consistency check

Let's do all the job on the database side without need to fetch any data
from there.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent d6b73ac7
......@@ -65,19 +65,18 @@ class ConsistencyCheck(TargetCheck):
# Do not check consistency if user asked not to have it
if not unit.translation.subproject.allow_translation_propagation:
return False
related = Unit.objects.same(unit)
if not related.exists():
return False
related = Unit.objects.same(
unit
).exclude(
target=unit.target
).filter(
translation__subproject__allow_translation_propagation=True
)
if not unit.translated:
related = related.filter(translated=True)
for unit2 in related.iterator():
if unit2.target != unit.target:
if unit2.translation.subproject.allow_translation_propagation:
return True
return False
return related.exists()
def check_single(self, source, target, unit, cache_slot):
'''
......
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