Fix missing events, show seconds delayed.

This commit is contained in:
tecnovert
2021-01-12 08:48:40 +02:00
parent 3cfc7d1437
commit ed22fe7d12
5 changed files with 19 additions and 19 deletions

View File

@@ -1725,9 +1725,8 @@ class BasicSwap(BaseApp):
query_str = 'SELECT created_at, trigger_at FROM eventqueue ' + \
'WHERE active_ind = 1 AND linked_id = x\'{}\' '.format(bid_id.hex())
q = session.execute(query_str)
events = []
for row in q:
events.append({'at': row[0], 'desc': 'Delaying until: {}'.format(format_timestamp(row[1]))})
events.append({'at': row[0], 'desc': 'Delaying until: {}'.format(format_timestamp(row[1], with_seconds=True))})
return events

View File

@@ -5,7 +5,6 @@
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import json
import time
import urllib.parse
from .util import (
@@ -84,7 +83,7 @@ def js_offers(self, url_split, post_string, sent=False):
ci_to = self.server.swap_client.ci(o.coin_to)
rv.append({
'offer_id': o.offer_id.hex(),
'created_at': time.strftime('%Y-%m-%d %H:%M', time.localtime(o.created_at)),
'created_at': format_timestamp(o.created_at),
'coin_from': ci_from.coin_name(),
'coin_to': ci_to.coin_name(),
'amount_from': ci_from.format_amount(o.amount_from),

View File

@@ -4,10 +4,9 @@
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import time
from .util import (
make_int,
format_timestamp,
)
from .chainparams import (
Coins,
@@ -133,8 +132,8 @@ def describeBid(swap_client, bid, xmr_swap, offer, xmr_offer, bid_events, edit_b
'offer_id': bid.offer_id.hex(),
'addr_from': bid.bid_addr,
'addr_fund_proof': bid.proof_address,
'created_at': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(bid.created_at)),
'expired_at': time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(bid.expire_at)),
'created_at': format_timestamp(bid.created_at, with_seconds=True),
'expired_at': format_timestamp(bid.expire_at, with_seconds=True),
'was_sent': 'True' if bid.was_sent else 'False',
'was_received': 'True' if bid.was_received else 'False',
'initiate_tx': getTxIdHex(bid, TxTypes.ITX, ' ' + ticker_from),

View File

@@ -306,8 +306,11 @@ def format_amount(i, display_scale, scale=None):
return rv
def format_timestamp(value):
return time.strftime('%Y-%m-%d %H:%M', time.localtime(value))
def format_timestamp(value, with_seconds=False):
str_format = '%Y-%m-%d %H:%M'
if with_seconds:
str_format += ':%S'
return time.strftime(str_format, time.localtime(value))
def getP2SHScriptForHash(p2sh):