From 40a5acbdf31abb30413d3ce2efaadd7ecc6998ec Mon Sep 17 00:00:00 2001 From: codl Date: Mon, 7 Aug 2017 15:53:34 +0200 Subject: [PATCH] improve archive list --- model.py | 7 +++++++ templates/logged_in.html | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/model.py b/model.py index 06377e0..3277825 100644 --- a/model.py +++ b/model.py @@ -144,3 +144,10 @@ class TwitterArchive(db.Model, TimestampMixin): chunks = db.Column(db.Integer) chunks_successful = db.Column(db.Integer, server_default='0', nullable=False) chunks_failed = db.Column(db.Integer, server_default='0', nullable=False) + + def status(): + if self.chunks == None or self.chunks_failed > 0: + return 'failed' + if self.chunks_successful == self.chunks: + return 'successful' + return 'pending' diff --git a/templates/logged_in.html b/templates/logged_in.html index e283dca..123d5bf 100644 --- a/templates/logged_in.html +++ b/templates/logged_in.html @@ -81,8 +81,12 @@

Recent archives

{% endif %}