mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 08:51:30 -05:00
Changed job_stats table to have an update at time stamp
This commit is contained in:
@@ -379,7 +379,6 @@ class TemplateHistory(db.Model):
|
|||||||
default=NORMAL)
|
default=NORMAL)
|
||||||
|
|
||||||
def serialize(self):
|
def serialize(self):
|
||||||
|
|
||||||
serialized = {
|
serialized = {
|
||||||
"id": self.id,
|
"id": self.id,
|
||||||
"type": self.template_type,
|
"type": self.template_type,
|
||||||
@@ -975,7 +974,6 @@ class Rate(db.Model):
|
|||||||
notification_type = db.Column(notification_types, index=True, nullable=False)
|
notification_type = db.Column(notification_types, index=True, nullable=False)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class JobStatistics(db.Model):
|
class JobStatistics(db.Model):
|
||||||
__tablename__ = 'job_statistics'
|
__tablename__ = 'job_statistics'
|
||||||
|
|
||||||
@@ -990,3 +988,20 @@ class JobStatistics(db.Model):
|
|||||||
sms_failed = db.Column(db.BigInteger, index=False, unique=False, nullable=False, default=0)
|
sms_failed = db.Column(db.BigInteger, index=False, unique=False, nullable=False, default=0)
|
||||||
letters_sent = db.Column(db.BigInteger, index=False, unique=False, nullable=False, default=0)
|
letters_sent = db.Column(db.BigInteger, index=False, unique=False, nullable=False, default=0)
|
||||||
letters_failed = db.Column(db.BigInteger, index=False, unique=False, nullable=False, default=0)
|
letters_failed = db.Column(db.BigInteger, index=False, unique=False, nullable=False, default=0)
|
||||||
|
updated_at = db.Column(
|
||||||
|
db.DateTime,
|
||||||
|
index=False,
|
||||||
|
unique=False,
|
||||||
|
nullable=True,
|
||||||
|
onupdate=datetime.datetime.utcnow)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
the_string = ""
|
||||||
|
the_string += "email sent {} email delivered {} email failed {} ".format(
|
||||||
|
self.emails_sent, self.emails_delivered, self.emails_failed
|
||||||
|
)
|
||||||
|
the_string += "sms sent {} sms delivered {} sms failed {} ".format(
|
||||||
|
self.sms_sent, self.sms_delivered, self.sms_failed
|
||||||
|
)
|
||||||
|
the_string += "letter sent {} letter failed {} ".format(self.letters_sent, self.letters_failed)
|
||||||
|
return the_string
|
||||||
|
|||||||
Reference in New Issue
Block a user