mirror of
https://github.com/simon987/od-database.git
synced 2025-04-20 10:56:47 +00:00
Nicer stats
This commit is contained in:
parent
e89eb6e3e0
commit
3335ec5f82
13
app.py
13
app.py
@ -61,6 +61,19 @@ def datetime_format(value, format='%Y-%m-%d %H:%M:%S'):
|
|||||||
return time.strftime(format, time.gmtime(value))
|
return time.strftime(format, time.gmtime(value))
|
||||||
|
|
||||||
|
|
||||||
|
@app.template.filetr("duration_format")
|
||||||
|
def duration_format(value):
|
||||||
|
delay = datetime.timedelta(seconds=value)
|
||||||
|
if (delay.days > 0):
|
||||||
|
out = str(delay).replace(" days, ", ":")
|
||||||
|
else:
|
||||||
|
out = "0:" + str(delay)
|
||||||
|
outAr = out.split(':')
|
||||||
|
outAr = ["%02d" % (int(float(x))) for x in outAr]
|
||||||
|
out = ":".join(outAr)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
@app.template_filter("from_timestamp")
|
@app.template_filter("from_timestamp")
|
||||||
def from_timestamp(value):
|
def from_timestamp(value):
|
||||||
return datetime.datetime.fromtimestamp(value)
|
return datetime.datetime.fromtimestamp(value)
|
||||||
|
@ -19,6 +19,9 @@ a {
|
|||||||
.table td {
|
.table td {
|
||||||
padding: 2px 0;
|
padding: 2px 0;
|
||||||
}
|
}
|
||||||
|
.table-numeric td {
|
||||||
|
text-align: end;
|
||||||
|
}
|
||||||
|
|
||||||
.bg-application {
|
.bg-application {
|
||||||
background: #8FB847;
|
background: #8FB847;
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h4>Crawl server stats</h4>
|
<h4>Crawl server stats</h4>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped table-numeric">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Server</th>
|
<th>Server</th>
|
||||||
@ -87,10 +87,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><b>{{ server }}</b></td>
|
<td><b>{{ server }}</b></td>
|
||||||
<td>{{ crawl_server_stats[server].task_count }}</td>
|
<td>{{ crawl_server_stats[server].task_count }}</td>
|
||||||
<td>{{ crawl_server_stats[server].time|round(2) }}s</td>
|
<td>{{ crawl_server_stats[server].time | duration_format() }}</td>
|
||||||
<td>{{ crawl_server_stats[server].time_avg|round(2) }}s</td>
|
<td>{{ crawl_server_stats[server].time_avg | duration_format() }}</td>
|
||||||
<td>{{ crawl_server_stats[server].file_count }}</td>
|
<td>{{ crawl_server_stats[server].file_count }}</td>
|
||||||
<td>{{ crawl_server_stats[server].file_count_avg | round(2) }}</td>
|
<td>{{ "%.2f" % crawl_server_stats[server].file_count_avg }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user