diff --git a/app.py b/app.py index 7c76db9..c8955eb 100644 --- a/app.py +++ b/app.py @@ -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')) diff --git a/templates/_table.html b/templates/_table.html index fab5a80..a39f93d 100644 --- a/templates/_table.html +++ b/templates/_table.html @@ -21,8 +21,7 @@ Failed {% endif %} -
- +
{{ tx.timestamp_formatted }} @@ -30,20 +29,25 @@ - {% for error in tx.errors_array %} -
-
{{ error }} -
+
+ + {% for error in tx.errors_array %} + + + + {% endfor %} +
+ + {{ error }} + +
- {% endfor %} {{ tx.cu_requested|default('no CU', True) }} {{ tx.prioritization_fees|default('no fees', True) }} diff --git a/transaction_database.py b/transaction_database.py index 239a0b8..81bc553 100644 --- a/transaction_database.py +++ b/transaction_database.py @@ -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():