Skip to content

Commit

Permalink
Process current month
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Feb 24, 2024
1 parent ca6c754 commit ff7bf8c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/voting_data/commons_votes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ def next(self) -> Month:
def is_current(self) -> bool:
return self == self.current_month()

def is_future(self) -> bool:
return self.months_to_current() < 0

def months_to_current(self) -> int:
current = self.current_month()
return (current.year - self.year) * 12 + current.month - self.month
Expand All @@ -57,7 +60,7 @@ def months_to_current(self) -> int:
@to_list
def all_months(cls) -> Iterator[Month]:
month = Month(2016, 3)
while not month.is_current():
while not month.is_future():
yield month
month = month.next()

Expand Down

0 comments on commit ff7bf8c

Please sign in to comment.