2323 DocRelationshipName , DocReminderTypeName , BallotPositionName , ReviewRequestStateName , FormalLanguageName ,
2424 DocUrlTagName )
2525from ietf .person .models import Email , Person
26+ from ietf .person .utils import get_active_ads
2627from ietf .utils import log
2728from ietf .utils .admin import admin_link
2829from ietf .utils .validators import validate_no_control_chars
@@ -1031,9 +1032,9 @@ class BallotDocEvent(DocEvent):
10311032
10321033 def active_ad_positions (self ):
10331034 """Return dict mapping each active AD to a current ballot position (or None if they haven't voted)."""
1034- active_ads = list (Person .objects .filter (role__name = "ad" , role__group__state = "active" , role__group__type = "area" ))
10351035 res = {}
10361036
1037+ active_ads = get_active_ads ()
10371038 positions = BallotPositionDocEvent .objects .filter (type = "changed_ballot_position" ,ad__in = active_ads , ballot = self ).select_related ('ad' , 'pos' ).order_by ("-time" , "-id" )
10381039
10391040 for pos in positions :
@@ -1050,7 +1051,7 @@ def all_positions(self):
10501051
10511052 positions = []
10521053 seen = {}
1053- active_ads = list ( Person . objects . filter ( role__name = "ad" , role__group__state = "active" , role__group__type = "area" ). distinct () )
1054+ active_ads = get_active_ads ( )
10541055 for e in BallotPositionDocEvent .objects .filter (type = "changed_ballot_position" , ballot = self ).select_related ('ad' , 'pos' ).order_by ("-time" , '-id' ):
10551056 if e .ad not in seen :
10561057 e .old_ad = e .ad not in active_ads
0 commit comments