[damned-lies] Fixed 'On-going activities' message with multiple domains with same name
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Fixed 'On-going activities' message with multiple domains with same name
- Date: Mon, 22 Aug 2016 13:56:24 +0000 (UTC)
commit 1b99a8ae5694eb2c484861a0e7f980b9031352f9
Author: Claude Paroz <claude 2xlibre net>
Date: Mon Aug 22 15:51:55 2016 +0200
Fixed 'On-going activities' message with multiple domains with same name
Fixes #770227. Thanks Alexandre Franke for the report.
vertimus/tests/tests.py | 19 +++++++++++++++++++
vertimus/views.py | 6 +++++-
2 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/vertimus/tests/tests.py b/vertimus/tests/tests.py
index 4e01e35..c20ae47 100644
--- a/vertimus/tests/tests.py
+++ b/vertimus/tests/tests.py
@@ -563,6 +563,25 @@ class VertimusTest(TeamsAndRolesTests):
response = self.client.get(url)
self.assertContains(response, '<option value="WC">')
+ def test_vertimus_view_on_going_activities(self):
+ master = Branch(name='master', module=self.m)
+ # Block the update of Statistics by the thread
+ master.save(update_statistics=False)
+ Statistics.objects.create(branch=master, domain=self.d, language=None)
+ dom_alt = Domain.objects.create(module=self.m, name='po',
+ description='UI translations',
+ dtype='ui', directory='po')
+ StateNone.objects.create(branch=master, domain=self.d, language=self.l)
+ StateNone.objects.create(branch=self.b, domain=dom_alt, language=self.l)
+
+ response = self.client.get(reverse('vertimus_by_ids', args=[master.pk, self.d.pk, self.l.pk]))
+ self.assertNotContains(response, "On-going activities in same module:")
+
+ state = State.objects.get(branch=self.b, domain=dom_alt, language=self.l)
+ state.change_state(StateTranslated)
+ response = self.client.get(reverse('vertimus_by_ids', args=[master.pk, self.d.pk, self.l.pk]))
+ self.assertContains(response, "On-going activities in same module:")
+
def test_uploaded_file_validation(self):
# Test a non valid po file
post_content = QueryDict('action=WC&comment=Test1')
diff --git a/vertimus/views.py b/vertimus/views.py
index bf2ac4e..0e44053 100644
--- a/vertimus/views.py
+++ b/vertimus/views.py
@@ -85,8 +85,12 @@ def vertimus(request, branch, domain, language, stats=None, level="0"):
# MySQL is subject to a race condition with default REPEATABLE READ isolation level
# See https://code.djangoproject.com/ticket/13906
state = State.objects.get(branch=branch, domain=domain, language=language)
+ # Filtering on domain.name instead of domain because we can have several domains
+ # working on the same set of strings (e.g. when an extraction method changed,
+ # each extraction is mapped to a different domain with branch_from/branch_to delimitations)
other_branch_states = State.objects.filter(
- domain=domain, language=language).exclude(branch=branch.pk).exclude(name='None')
+ branch__module=branch.module, domain__name=domain.name, language=language
+ ).exclude(branch=branch.pk).exclude(name='None')
if level == 0:
# Current actions
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]