Skip to content

Instantly share code, notes, and snippets.

@mathjazz
Created July 26, 2017 18:11
Show Gist options
  • Select an option

  • Save mathjazz/157cfac33073306892c38039d45e7093 to your computer and use it in GitHub Desktop.

Select an option

Save mathjazz/157cfac33073306892c38039d45e7093 to your computer and use it in GitHub Desktop.
diff --git a/pontoon/base/views.py b/pontoon/base/views.py
index dd503ad..15fc6ec 100755
--- a/pontoon/base/views.py
+++ b/pontoon/base/views.py
@@ -583,8 +583,9 @@ def update_translation(request):
if len(translations) > 0:
# Same translation exists
- try:
- t = translations.get(string=string)
+ same_translations = translations.filter(string=string).order_by('-approved', '-date')
+ if len(same_translations) > 0:
+ t = same_translations[0]
# If added by privileged user, approve and unfuzzy it
if can_translate:
@@ -652,7 +653,7 @@ def update_translation(request):
})
# Different translation added
- except:
+ else:
warnings = utils.quality_check(original, string, l, ignore)
if warnings:
return warnings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment