diff --git a/ietf/doc/models.py b/ietf/doc/models.py index 0e2502974..eb66b658a 100644 --- a/ietf/doc/models.py +++ b/ietf/doc/models.py @@ -81,6 +81,8 @@ class State(models.Model): ordering = ["type", "order"] IESG_BALLOT_ACTIVE_STATES = ("lc", "writeupw", "goaheadw", "iesg-eva", "defer") +IESG_CHARTER_ACTIVE_STATES = ("intrev", "extrev", "iesgrev") +IESG_STATCHG_CONFLREV_ACTIVE_STATES = ("iesgeval", "defer") IESG_SUBSTATE_TAGS = ('ad-f-up', 'need-rev', 'extpty') class DocumentInfo(models.Model): diff --git a/ietf/doc/tests.py b/ietf/doc/tests.py index e1e57e1d6..e5adf0836 100644 --- a/ietf/doc/tests.py +++ b/ietf/doc/tests.py @@ -240,7 +240,7 @@ class SearchTests(TestCase): conflrev.set_state(State.objects.get(type='conflrev', slug='iesgeval')) statchg = DocumentFactory(type_id='statchg',ad=ad) statchg.set_state(State.objects.get(type='statchg', slug='iesgeval')) - charter = CharterFactory(ad=ad) + charter = CharterFactory(name='charter-ietf-ames',ad=ad) charter.set_state(State.objects.get(type='charter', slug='iesgrev')) ballot_type = BallotType.objects.get(doc_type_id='draft',slug='approve') @@ -248,6 +248,13 @@ class SearchTests(TestCase): discuss_pos = BallotPositionName.objects.get(slug='discuss') discuss_other = BallotPositionDocEventFactory(ballot=ballot, doc=ballot.doc, balloter=ad, pos=discuss_pos) + blockedcharter = CharterFactory(name='charter-ietf-mars',ad=ad) + blockedcharter.set_state(State.objects.get(type='charter',slug='extrev')) + charter_ballot_type = BallotType.objects.get(doc_type_id='charter',slug='approve') + charterballot = BallotDocEventFactory(ballot_type=charter_ballot_type, doc__states=[('charter','extrev')]) + block_pos = BallotPositionName.objects.get(slug='block') + block_other = BallotPositionDocEventFactory(ballot=charterballot, doc=ballot.doc, balloter=ad, pos=block_pos) + r = self.client.get(urlreverse('ietf.doc.views_search.docs_for_ad', kwargs=dict(name=ad.full_name_as_key()))) self.assertEqual(r.status_code, 200) self.assertContains(r, draft.name) @@ -258,6 +265,7 @@ class SearchTests(TestCase): self.assertContains(r, charter.name) self.assertContains(r, discuss_other.doc.name) + self.assertContains(r, block_other.doc.name) def test_auth48_doc_for_ad(self): """Docs in AUTH48 state should have a decoration""" diff --git a/ietf/doc/views_search.py b/ietf/doc/views_search.py index 64fa0dc41..40818c8e6 100644 --- a/ietf/doc/views_search.py +++ b/ietf/doc/views_search.py @@ -51,7 +51,9 @@ from django.utils.cache import _generate_cache_key # type: ignore import debug # pyflakes:ignore from ietf.doc.models import ( Document, DocHistory, DocAlias, State, - LastCallDocEvent, NewRevisionDocEvent, IESG_SUBSTATE_TAGS, IESG_BALLOT_ACTIVE_STATES ) + LastCallDocEvent, NewRevisionDocEvent, IESG_SUBSTATE_TAGS, + IESG_BALLOT_ACTIVE_STATES, IESG_STATCHG_CONFLREV_ACTIVE_STATES, + IESG_CHARTER_ACTIVE_STATES ) from ietf.doc.fields import select2_id_doc_name_json from ietf.doc.utils import get_search_cache_key, augment_events_with_revision from ietf.group.models import Group @@ -420,9 +422,9 @@ def docs_for_ad(request, name): possible_docs = Document.objects.filter(Q(states__type="draft-iesg", states__slug__in=IESG_BALLOT_ACTIVE_STATES) | Q(states__type="charter", - states__slug__in=("intrev", "iesgrev")) | + states__slug__in=IESG_CHARTER_ACTIVE_STATES) | Q(states__type__in=("statchg", "conflrev"), - states__slug__in=("iesgeval", "defer")), + states__slug__in=IESG_STATCHG_CONFLREV_ACTIVE_STATES), docevent__ballotpositiondocevent__pos__blocking=True, docevent__ballotpositiondocevent__balloter=ad).distinct() for doc in possible_docs: @@ -431,7 +433,6 @@ def docs_for_ad(request, name): continue blocking_positions = [p for p in ballot.all_positions() if p.pos.blocking] - if not blocking_positions or not any( p.balloter==ad for p in blocking_positions ): continue @@ -446,6 +447,10 @@ def docs_for_ad(request, name): if blocked_docs: blocked_docs.sort(key=lambda d: min(p.time for p in d.blocking_positions if p.balloter==ad), reverse=True) + for d in blocked_docs: + if d.get_base_name() == 'charter-ietf-shmoo-01-04.txt': + print('Is in list') + return render(request, 'doc/drafts_for_ad.html', { 'form':form, 'docs':results, 'meta':meta, 'ad_name': ad.plain_name(), 'blocked_docs': blocked_docs })