Updating model with date_created

This commit is contained in:
Denis-Cosmin Nutiu 2017-05-28 14:43:44 +03:00
parent a40164da9a
commit 69f564a26f
2 changed files with 37 additions and 25 deletions

View file

@ -33,6 +33,7 @@ class Result(db.Model):
log = db.Column(db.Text)
score = db.Column(db.Integer, index=True)
ip = db.Column(sqlalchemy_utils.IPAddressType)
created = db.Column(db.DateTime(timezone=True), server_default=db.func.now()) # Update time created server time.
def __init__(self, name="Anonymous", gpu=None, cpu=None, log=None, ip=None, score=1):
self.name = name

View file

@ -5,11 +5,13 @@
{{ super() }}
<div class="page-header">
<h1>{{ name.name | capitalize }}'s result <small>Yeeeah!</small></h1>
<h1>{{ name.name | capitalize }}'s result
<small>Yeeeah!</small>
</h1>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Detailed View</h3>
<h3 class="panel-title">Detailed View <small class="pull-right">({{ name.created }})</small></h3>
</div>
<div class="panel-body">
<div class="progress">
@ -19,10 +21,19 @@
<span class="sr-only">{{ progress_bar['value'] }}% Complete </span>
</div>
</div>
<h2><small><i class="glyphicon glyphicon-plus"></i></small> Score: {{ name.score }}</h2>
<h3><small><i class="glyphicon glyphicon-leaf"></i></small> GPU: {{ name.gpu | safe}}</h3>
<h3><small><i class="glyphicon glyphicon-hdd"></i></small> CPU: {{ name.cpu | safe}}</h3>
<h3><small><i class="glyphicon glyphicon-list-alt"></i></small> Logfile</h3>
<h2>
<small><i class="glyphicon glyphicon-plus"></i></small>
Score: {{ name.score }}</h2>
<h3>
<small><i class="glyphicon glyphicon-leaf"></i></small>
GPU: {{ name.gpu | safe }}</h3>
<h3>
<small><i class="glyphicon glyphicon-hdd"></i></small>
CPU: {{ name.cpu | safe }}</h3>
<h3>
<small><i class="glyphicon glyphicon-list-alt"></i></small>
Logfile
</h3>
<div class="well">
{{ name.log | safe }}
</div>