improve archive list
This commit is contained in:
parent
deda43fd8a
commit
40a5acbdf3
7
model.py
7
model.py
|
@ -144,3 +144,10 @@ class TwitterArchive(db.Model, TimestampMixin):
|
||||||
chunks = db.Column(db.Integer)
|
chunks = db.Column(db.Integer)
|
||||||
chunks_successful = db.Column(db.Integer, server_default='0', nullable=False)
|
chunks_successful = db.Column(db.Integer, server_default='0', nullable=False)
|
||||||
chunks_failed = 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'
|
||||||
|
|
|
@ -81,8 +81,12 @@
|
||||||
<h3 id="recent_archives">Recent archives</h3>
|
<h3 id="recent_archives">Recent archives</h3>
|
||||||
<ul>
|
<ul>
|
||||||
{% for archive in g.viewer.account.twitter_archives %}
|
{% for archive in g.viewer.account.twitter_archives %}
|
||||||
<li>{{archive.created_at.strftime('%Y-%m-%d %H:%M')}}<br>
|
<li class="tweet_archive" data-status="{{archive.status()}}">{{archive.created_at.strftime('%Y-%m-%d %H:%M')}}<br>
|
||||||
|
{% if archive.chunks == None %}
|
||||||
{{archive.chunks_successful}}/{{archive.chunks}} months imported, {{archive.chunks_failed}} failed</li>
|
{{archive.chunks_successful}}/{{archive.chunks}} months imported, {{archive.chunks_failed}} failed</li>
|
||||||
|
{% else %}
|
||||||
|
Archive could not be opened
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in New Issue