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) log = db.Column(db.Text)
score = db.Column(db.Integer, index=True) score = db.Column(db.Integer, index=True)
ip = db.Column(sqlalchemy_utils.IPAddressType) 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): def __init__(self, name="Anonymous", gpu=None, cpu=None, log=None, ip=None, score=1):
self.name = name self.name = name

View file

@ -2,31 +2,42 @@
{% block title %}FOTB - Result #{{ name.id }} {% endblock %} {% block title %}FOTB - Result #{{ name.id }} {% endblock %}
{% block main %} {% block main %}
{{ super() }} {{ super() }}
<div class="page-header"> <div class="page-header">
<h1>{{ name.name | capitalize }}'s result <small>Yeeeah!</small></h1> <h1>{{ name.name | capitalize }}'s result
</div> <small>Yeeeah!</small>
<div class="panel panel-default"> </h1>
<div class="panel-heading"> </div>
<h3 class="panel-title">Detailed View</h3> <div class="panel panel-default">
</div> <div class="panel-heading">
<div class="panel-body"> <h3 class="panel-title">Detailed View <small class="pull-right">({{ name.created }})</small></h3>
<div class="progress"> </div>
<div class="progress-bar {{ progress_bar['class'] }}" role="progressbar" <div class="panel-body">
aria-valuenow="{{ progress_bar['value'] }}" aria-valuemin="0" <div class="progress">
aria-valuemax="100" style="width: {{ progress_bar['value'] }}%"> <div class="progress-bar {{ progress_bar['class'] }}" role="progressbar"
<span class="sr-only">{{ progress_bar['value'] }}% Complete </span> aria-valuenow="{{ progress_bar['value'] }}" aria-valuemin="0"
</div> aria-valuemax="100" style="width: {{ progress_bar['value'] }}%">
</div> <span class="sr-only">{{ progress_bar['value'] }}% Complete </span>
<h2><small><i class="glyphicon glyphicon-plus"></i></small> Score: {{ name.score }}</h2> </div>
<h3><small><i class="glyphicon glyphicon-leaf"></i></small> GPU: {{ name.gpu | safe}}</h3> </div>
<h3><small><i class="glyphicon glyphicon-hdd"></i></small> CPU: {{ name.cpu | safe}}</h3> <h2>
<h3><small><i class="glyphicon glyphicon-list-alt"></i></small> Logfile</h3> <small><i class="glyphicon glyphicon-plus"></i></small>
<div class="well"> Score: {{ name.score }}</h2>
{{ name.log | safe }} <h3>
</div> <small><i class="glyphicon glyphicon-leaf"></i></small>
</div> GPU: {{ name.gpu | safe }}</h3>
</div> <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>
</div>
</div>
{% endblock %} {% endblock %}