def key(self):
return self.generate_key(self.option_a, self.option_b)
+ @property
+ def end_date(self):
+ return datetime.fromtimestamp(self.ending_at)
+
def votes_a(self) -> int:
return len([vote for vote in self.votes.values() if vote == self.option_a])
status_message = (f"**Poll status:**\n"
f" * {self.option_a}: {self.votes_a()}\n"
f" * {self.option_b}: {self.votes_b()}"
- ) + (f"\n{winner}" if self.due() else "")
+ ) + (f"\n{winner}" if self.due() else f"\nEnding at: {self.end_date}")
return status_message
vote_duration = self.vote_duration
if len(words) == 5:
try:
- vote_duration = max(30, min(60 * 60 * 3, int(words[4])))
+ vote_duration = max(30, min(self.max_vote_duration, int(words[4])))
except ValueError as e:
logger.exception("Failed parsing intended duration", exc_info=e)
# setup new poll
else:
prior_poll = self.get_poll(poll.key)
if prior_poll and prior_poll.votes:
- date = datetime.fromtimestamp(prior_poll.ending_at)
- return Action(msg=f"This was already decided at {date}: {prior_poll.status_report()}")
+
+ return Action(msg=f"This was already decided at {prior_poll.end_date}: {prior_poll.status_report()}")
# enable poll
self.start_poll(poll)