Commit 4f7a2d7a authored by Michal Čihař's avatar Michal Čihař

Correctly add new suggestions on suggestion import

parent dd527c54
...@@ -1089,16 +1089,14 @@ class Translation(models.Model, URLMixin): ...@@ -1089,16 +1089,14 @@ class Translation(models.Model, URLMixin):
# Calculate unit checksum # Calculate unit checksum
checksum = unit.get_checksum() checksum = unit.get_checksum()
# Create suggestion objects. # Grab database unit
# We don't care about duplicates or non existing strings here dbunit = self.unit_set.filter(checksum=checksum)
# this is better handled in cleanup. if not dbunit.exists():
Suggestion.objects.create( continue
target=unit.get_target(), dbunit = dbunit[0]
checksum=checksum,
language=self.language, # Add suggestion
project=self.subproject.project, dbunit.add_suggestion(unit.get_target(), request.user)
user=request.user
)
# Update suggestion count # Update suggestion count
if ret: if ret:
......
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