Skip to content

Commit c245f6a

Browse files
committed
Make .ballot_open() available on DocumentInfo instead of on Document, too.
- Legacy-Id: 4807
1 parent fc22a66 commit c245f6a

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

ietf/doc/models.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ def get_state_slug(self, state_type=None):
127127
def author_list(self):
128128
return ", ".join(email.address for email in self.authors.all())
129129

130+
# This, and several other ballot related functions here, assume that there is only one active ballot for a document at any point in time.
131+
# If that assumption is violated, they will only expose the most recently created ballot
132+
def ballot_open(self, ballot_type_slug):
133+
e = self.latest_event(BallotDocEvent, ballot_type__slug=ballot_type_slug)
134+
return e and not e.type == "closed_ballot"
135+
130136
def active_ballot(self):
131137
"""Returns the most recently created ballot if it isn't closed."""
132138
ballot = self.latest_event(BallotDocEvent, type="created_ballot")
@@ -267,12 +273,6 @@ def active_defer_event(self):
267273
return self.latest_event(type="changed_document", desc__startswith="State changed to <b>IESG Evaluation - Defer</b>")
268274
return None
269275

270-
# This, and several other ballot related functions here, assume that there is only one active ballot for a document at any point in time.
271-
# If that assumption is violated, they will only expose the most recently created ballot
272-
def ballot_open(self, ballot_type_slug):
273-
e = self.latest_event(BallotDocEvent, ballot_type__slug=ballot_type_slug)
274-
return e and not e.type == "closed_ballot"
275-
276276
def most_recent_ietflc(self):
277277
"""Returns the most recent IETF LastCallDocEvent for this document"""
278278
return self.latest_event(LastCallDocEvent,type="sent_last_call")

0 commit comments

Comments
 (0)