Merged in [16904] from sasha@dashcare.nl:
Fix #2118 - Always list all last call drafts in assignment summary.
If a draft is scheduled for a telechat, but also assigned for LC review,
it will now be listed both in the telechat section and under 'last calls'.
- Legacy-Id: 16913
Note: SVN reference [16904] has been migrated to Git commit 82c63b49f3
This commit is contained in:
commit
91d0a79a16
|
@ -240,6 +240,8 @@ class ReviewTests(TestCase):
|
|||
review_req1 = ReviewRequestFactory()
|
||||
review_assignment_completed = ReviewAssignmentFactory(review_request=review_req1,reviewer=EmailFactory(person__user__username='marschairman'), state_id='completed', reviewed_rev=0)
|
||||
ReviewAssignmentFactory(review_request=review_req1,reviewer=review_assignment_completed.reviewer)
|
||||
TelechatDocEvent.objects.create(telechat_date=datetime.date.today(), type='scheduled_for_telechat', by=review_assignment_completed.reviewer.person, doc=review_req1.doc, rev=0)
|
||||
|
||||
DBTemplateFactory.create(path='/group/defaults/email/open_assignments.txt',
|
||||
type_id='django',
|
||||
content = """
|
||||
|
@ -270,8 +272,10 @@ class ReviewTests(TestCase):
|
|||
self.assertEqual(r.status_code, 200)
|
||||
q = PyQuery(r.content)
|
||||
generated_text = q("[name=body]").text()
|
||||
self.assertTrue(review_req1.doc.name in generated_text)
|
||||
self.assertTrue('(-0 lc reviewed)' in generated_text) # previous completed assignment
|
||||
# The document should be listed both for the telechat, and in the last call section,
|
||||
# i.e. the document name is expected twice in the output (#2118)
|
||||
self.assertEqual(generated_text.count(review_req1.doc.name), 2)
|
||||
self.assertEqual(generated_text.count('(-0 lc reviewed)'), 2) # previous completed assignment
|
||||
self.assertTrue(six.text_type(Person.objects.get(user__username="marschairman")) in generated_text)
|
||||
|
||||
empty_outbox()
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
from __future__ import absolute_import, print_function, unicode_literals
|
||||
|
||||
import copy
|
||||
import datetime
|
||||
import itertools
|
||||
import io
|
||||
|
@ -1591,8 +1592,6 @@ def email_open_review_assignments(request, acronym, group_type=None):
|
|||
state__in=("assigned", "accepted"),
|
||||
).prefetch_related("reviewer", "review_request__type", "state", "review_request__doc").distinct().order_by("reviewer","-review_request__deadline"))
|
||||
|
||||
review_assignments.sort(key=lambda r:r.reviewer.person.last_name()+r.reviewer.person.first_name())
|
||||
|
||||
for r in review_assignments:
|
||||
if r.review_request.doc.telechat_date():
|
||||
r.section = 'For telechat %s' % r.review_request.doc.telechat_date().isoformat()
|
||||
|
@ -1610,7 +1609,19 @@ def email_open_review_assignments(request, acronym, group_type=None):
|
|||
earlier_reviews_formatted = ['-{} {} reviewed'.format(ra.reviewed_rev, ra.review_request.type.slug) for ra in r.earlier_review]
|
||||
r.earlier_reviews = '({})'.format(', '.join(earlier_reviews_formatted))
|
||||
|
||||
review_assignments.sort(key=lambda r: r.section_order)
|
||||
# If a document is both scheduled for a telechat and a last call review, replicate
|
||||
# a copy of the review assignment in the last calls section (#2118)
|
||||
def should_be_replicated_in_last_call_section(r):
|
||||
return r.section.startswith('For telechat') and r.review_request.type_id != 'early'
|
||||
|
||||
for r in filter(should_be_replicated_in_last_call_section, review_assignments):
|
||||
r_new = copy.copy(r)
|
||||
r_new.section = 'Last calls:'
|
||||
r_new.section_order = '1'
|
||||
review_assignments.append(r_new)
|
||||
|
||||
review_assignments.sort(key=lambda r: r.section_order + r.reviewer.person.last_name() +
|
||||
r.reviewer.person.first_name())
|
||||
|
||||
back_url = request.GET.get("next")
|
||||
if not back_url:
|
||||
|
|
Loading…
Reference in a new issue