Commit 56e58e90 authored by Michal Čihař's avatar Michal Čihař

Do not increase counter in case of no change

parent adad459d
......@@ -2553,7 +2553,7 @@ class Unit(models.Model):
except FileLockException:
logger.error('failed to lock backend for %s!', self)
messages.error(request, _('Failed to store message in the backend, lock timeout occurred!'))
return
return False
# Handle situation when backend did not find the message
if pounit is None:
......@@ -2561,12 +2561,12 @@ class Unit(models.Model):
messages.error(request, _('Message not found in backend storage, it is probably corrupted.'))
# Try reloading from backend
self.translation.update_from_blob(True)
return
return False
# Return if there was no change
if not saved and propagate:
self.propagate(request)
return
return False
# Update translated flag
self.translated = is_translated(pounit)
......
......@@ -1362,11 +1362,13 @@ def translate(request, project, subproject, lang):
# Update unit and save it
unit.target = join_plural(form.cleaned_data['target'])
unit.fuzzy = form.cleaned_data['fuzzy']
unit.save_backend(request)
saved = unit.save_backend(request)
# Update stats
if saved:
# Update userstats
profile.translated += 1
profile.save()
# Get new set of checks
newchecks = set(
unit.active_checks().values_list('check', flat=True)
......
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