mirror of
https://github.com/GSA/notifications-api.git
synced 2026-07-24 09:58:53 -04:00
Making more things work better for agreement status.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -206,6 +206,7 @@ class AgreementStatus(StrEnum):
|
||||
WAITING = "waiting"
|
||||
ACTIVE = "active"
|
||||
EXPIRED = "expired"
|
||||
UNKNOWN = "unknown"
|
||||
|
||||
|
||||
class StatisticsType(StrEnum):
|
||||
|
||||
@@ -2332,8 +2332,8 @@ class Agreement(db.Model):
|
||||
|
||||
|
||||
@hybrid_property
|
||||
def status(self):
|
||||
current_time = datetime.utcnow()
|
||||
def status(self) -> AgreementStatus:
|
||||
current_time = datetime.datetime.now(datetime.UTC)
|
||||
if self.start_time and self.end_time:
|
||||
if current_time < self.start_time:
|
||||
return AgreementStatus.WAITING
|
||||
@@ -2341,7 +2341,8 @@ class Agreement(db.Model):
|
||||
return AgreementStatus.EXPIRED
|
||||
else:
|
||||
return AgreementStatus.ACTIVE
|
||||
return None
|
||||
# Likely one or both are None.
|
||||
return AgreementStatus.UNKNOWN
|
||||
|
||||
|
||||
def serialize(self):
|
||||
|
||||
Reference in New Issue
Block a user