rename timestamp

This commit is contained in:
GroovieGermanikus 2023-10-17 15:31:17 +02:00
parent 1b30a13d46
commit 5fbe22596c
No known key found for this signature in database
GPG Key ID: 5B6EB831A5CD2015
3 changed files with 23 additions and 14 deletions

6
app.py
View File

@ -43,8 +43,10 @@ def update_load():
while True:
time.sleep(1)
maprows = transaction_database.RunQuery()
# TODO remove - this is for testing only
shuffle(maprows)
# manipulate the data to proof that the push works
if len(maprows) > 0:
maprows[0]['pos'] = 1000 + round(time.time()) % 9000
maprows[0]['errors_array'] = ["Account in use-12112:42","Account in use-12112:43"]
# note: the push sends update to all subscribed clients
turbo.push(turbo.replace(render_template('_table.html', transactions=maprows), 'datatable'))

View File

@ -21,8 +21,7 @@
<td><span class="badge bg-warning-soft">Failed</span></td>
{% endif %}
<td>
<div class="align-items-center text-truncate" style="width:300px">
<span class="font-size-tiny me-2"></span>
<div class="align-items-center">
<span class="font-monospace text-muted">
{{ tx.timestamp_formatted }}
</span>
@ -30,20 +29,25 @@
</td>
<td>
<div class="align-items-center text-truncate" style="width:300px">
<span class="font-size-tiny me-2"></span>
<span class="font-monospace">
<a href="https://explorer.solana.com/tx/{{ tx.signature }}">{{ tx.signature }}</a>
</span>
</div>
</td>
<td>
{% for error in tx.errors_array %}
<div class="d-flex align-items-center">
<div class="d-flex align-items-center"><span class="font-size-tiny me-2"></span><span
class="font-monospace text-danger">{{ error }}</span>
</div>
<div class="d-flex align-items-left">
<table>
{% for error in tx.errors_array %}
<tr>
<td>
<span class="font-monospace text-danger">
{{ error }}
</span>
</td>
</tr>
{% endfor %}
</table>
</div>
{% endfor %}
</td>
<td class="text-end"><span class="font-monospace">{{ tx.cu_requested|default('no CU', True) }}</span></td>
<td class="text-end">{{ tx.prioritization_fees|default('no fees', True) }}</td>

View File

@ -20,12 +20,12 @@ def RunQuery():
cu_requested,
prioritization_fees,
-- "OCT 17 12:29:17.5127"
"timestamp",
to_char("timestamp", 'MON DD HH24:MI:SS.FF4') as timestamp_formatted,
utc_timestamp,
to_char(utc_timestamp, 'MON DD HH24:MI:SS.FF4') as timestamp_formatted,
accounts_used
FROM banking_stage_results.transaction_infos
WHERE true
ORDER BY "timestamp" DESC
ORDER BY utc_timestamp DESC
) AS data
""")
@ -38,6 +38,9 @@ def RunQuery():
print(row)
print("...")
for row in maprows:
row['errors_array'] = row['errors'].rstrip().split(';')
return maprows
def Main():