fix: Include blocked charters in AD dashboard that are in external review (#3689)

This commit is contained in:
Russ Housley 2022-03-19 12:59:04 -04:00 committed by GitHub
parent 311bbf8826
commit 74d30529b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 5 deletions

View file

@ -81,6 +81,8 @@ class State(models.Model):
ordering = ["type", "order"] ordering = ["type", "order"]
IESG_BALLOT_ACTIVE_STATES = ("lc", "writeupw", "goaheadw", "iesg-eva", "defer") 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') IESG_SUBSTATE_TAGS = ('ad-f-up', 'need-rev', 'extpty')
class DocumentInfo(models.Model): class DocumentInfo(models.Model):

View file

@ -240,7 +240,7 @@ class SearchTests(TestCase):
conflrev.set_state(State.objects.get(type='conflrev', slug='iesgeval')) conflrev.set_state(State.objects.get(type='conflrev', slug='iesgeval'))
statchg = DocumentFactory(type_id='statchg',ad=ad) statchg = DocumentFactory(type_id='statchg',ad=ad)
statchg.set_state(State.objects.get(type='statchg', slug='iesgeval')) 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')) charter.set_state(State.objects.get(type='charter', slug='iesgrev'))
ballot_type = BallotType.objects.get(doc_type_id='draft',slug='approve') 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_pos = BallotPositionName.objects.get(slug='discuss')
discuss_other = BallotPositionDocEventFactory(ballot=ballot, doc=ballot.doc, balloter=ad, pos=discuss_pos) 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()))) 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.assertEqual(r.status_code, 200)
self.assertContains(r, draft.name) self.assertContains(r, draft.name)
@ -258,6 +265,7 @@ class SearchTests(TestCase):
self.assertContains(r, charter.name) self.assertContains(r, charter.name)
self.assertContains(r, discuss_other.doc.name) self.assertContains(r, discuss_other.doc.name)
self.assertContains(r, block_other.doc.name)
def test_auth48_doc_for_ad(self): def test_auth48_doc_for_ad(self):
"""Docs in AUTH48 state should have a decoration""" """Docs in AUTH48 state should have a decoration"""

View file

@ -51,7 +51,9 @@ from django.utils.cache import _generate_cache_key # type: ignore
import debug # pyflakes:ignore import debug # pyflakes:ignore
from ietf.doc.models import ( Document, DocHistory, DocAlias, State, 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.fields import select2_id_doc_name_json
from ietf.doc.utils import get_search_cache_key, augment_events_with_revision from ietf.doc.utils import get_search_cache_key, augment_events_with_revision
from ietf.group.models import Group 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", possible_docs = Document.objects.filter(Q(states__type="draft-iesg",
states__slug__in=IESG_BALLOT_ACTIVE_STATES) | states__slug__in=IESG_BALLOT_ACTIVE_STATES) |
Q(states__type="charter", Q(states__type="charter",
states__slug__in=("intrev", "iesgrev")) | states__slug__in=IESG_CHARTER_ACTIVE_STATES) |
Q(states__type__in=("statchg", "conflrev"), 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__pos__blocking=True,
docevent__ballotpositiondocevent__balloter=ad).distinct() docevent__ballotpositiondocevent__balloter=ad).distinct()
for doc in possible_docs: for doc in possible_docs:
@ -431,7 +433,6 @@ def docs_for_ad(request, name):
continue continue
blocking_positions = [p for p in ballot.all_positions() if p.pos.blocking] 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 ): if not blocking_positions or not any( p.balloter==ad for p in blocking_positions ):
continue continue
@ -446,6 +447,10 @@ def docs_for_ad(request, name):
if blocked_docs: if blocked_docs:
blocked_docs.sort(key=lambda d: min(p.time for p in d.blocking_positions if p.balloter==ad), reverse=True) 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', { return render(request, 'doc/drafts_for_ad.html', {
'form':form, 'docs':results, 'meta':meta, 'ad_name': ad.plain_name(), 'blocked_docs': blocked_docs 'form':form, 'docs':results, 'meta':meta, 'ad_name': ad.plain_name(), 'blocked_docs': blocked_docs
}) })