1111from ietf .name .models import DocReminderTypeName , DocRelationshipName
1212from ietf .group .models import Role
1313from ietf .ietfauth .utils import has_role
14- from ietf .person .models import Person
1514from ietf .utils import draft
1615
1716def get_state_types (doc ):
@@ -59,6 +58,12 @@ def can_adopt_draft(user, doc):
5958 group__state = "active" ,
6059 person__user = user ).exists ())
6160
61+
62+ def two_thirds_rule ( recused = 0 ):
63+ # For standards-track, need positions from 2/3 of the non-recused current IESG.
64+ active = Role .objects .filter (name = "ad" ,group__state = "active" ).count ()
65+ return int (math .ceil ((active - recused ) * 2.0 / 3.0 ))
66+
6267def needed_ballot_positions (doc , active_positions ):
6368 '''Returns text answering the question "what does this document
6469 need to pass?". The return value is only useful if the document
@@ -81,11 +86,12 @@ def needed_ballot_positions(doc, active_positions):
8186 answer .append ("Has %d %ss." % (len (blocking ), blocking [0 ].pos .name .upper ()))
8287 needed = 1
8388 if doc .type_id == "draft" and doc .intended_std_level_id in ("bcp" , "ps" , "ds" , "std" ):
84- # For standards-track, need positions from 2/3 of the
85- # non-recused current IESG.
86- active = len (Person .objects .filter (role__name = "ad" ,
87- role__group__state = "active" ).distinct ())
88- needed = int (math .ceil ((active - len (recuse )) * 2.0 / 3.0 ))
89+ needed = two_thirds_rule (recused = len (recuse ))
90+ elif doc .type_id == "statchg" :
91+ for rel in doc .relateddocument_set .filter (relationship__slug__in = ['tops' , 'tois' , 'tohist' , 'toinf' , 'tobcp' , 'toexp' ]):
92+ if (rel .target .document .std_level .slug in ['bcp' ,'ps' ,'ds' ,'std' ]) or (rel .relationship .slug in ['tops' ,'tois' ,'tobcp' ]):
93+ needed = two_thirds_rule (recused = len (recuse ))
94+ break
8995 else :
9096 if len (yes ) < 1 :
9197 return " " .join (answer )
0 commit comments