add TUVoteInfo.is_running() method

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-06-18 04:40:54 -07:00
parent 07c4be0afb
commit 4927a61378
2 changed files with 21 additions and 1 deletions

View file

@ -1,5 +1,7 @@
import typing
from datetime import datetime
from sqlalchemy import Column, ForeignKey, Integer
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import backref, relationship
@ -85,3 +87,6 @@ class TUVoteInfo(Base):
""" Customize getattr to floatify any fetched Quorum values. """
attr = super().__getattribute__(key)
return float(attr) if key == "Quorum" else attr
def is_running(self):
return self.End > int(datetime.utcnow().timestamp())