Commit 2877a799 authored by Vincent Texier's avatar Vincent Texier

[enh] #798 Underline transactions with special conditions in tx history

parent d5674c3d
......@@ -6,13 +6,16 @@ TX_HISTORY_REQUEST = """
SELECT
transactions.ts,
transactions.pubkey,
total_amount((amount * -1), amountbase) as amount,
total_amount((transactions.amount * -1), transactions.amountbase) as amount,
transactions.comment ,
transactions.sha_hash,
transactions.written_on,
transactions.txid
transactions.txid,
sources.conditions
FROM
transactions
LEFT JOIN sources ON sources.identifier = transactions.sha_hash and
(sources.conditions LIKE "%&&%" OR sources.conditions LIKE "%||%")
WHERE
transactions.currency = ?
and transactions.pubkey = ?
......@@ -24,13 +27,16 @@ UNION ALL
SELECT
transactions.ts,
transactions.pubkey,
total_amount(amount, amountbase) as amount,
total_amount(transactions.amount, transactions.amountbase) as amount,
transactions.comment ,
transactions.sha_hash,
transactions.written_on,
transactions.txid
transactions.txid,
sources.conditions
FROM
transactions
LEFT JOIN sources ON sources.identifier = transactions.sha_hash and
(sources.conditions LIKE "%&&%" OR sources.conditions LIKE "%||%")
WHERE
transactions.currency = ?
and transactions.pubkey = ?
......@@ -42,11 +48,12 @@ UNION ALL
SELECT
dividends.timestamp as ts,
dividends.pubkey ,
total_amount(amount, base) as amount,
total_amount(dividends.amount, dividends.base) as amount,
NULL as comment,
NULL as sha_hash,
dividends.block_number AS written_on,
0 as txid
0 as txid,
NULL
FROM
dividends
WHERE
......
......@@ -39,6 +39,7 @@ class HistoryTableModel(QAbstractTableModel):
"block_number",
"txhash",
"raw_data",
"conditions",
)
columns_to_sql = {
......@@ -232,6 +233,7 @@ class HistoryTableModel(QAbstractTableModel):
block_number,
transfer.sha_hash,
transfer,
transfer.conditions,
)
def data_sent(self, transfer):
......@@ -267,6 +269,7 @@ class HistoryTableModel(QAbstractTableModel):
block_number,
transfer.sha_hash,
transfer,
transfer.conditions,
)
def data_dividend(self, dividend):
......@@ -299,6 +302,7 @@ class HistoryTableModel(QAbstractTableModel):
block_number,
"",
dividend,
dividend.conditions,
)
def init_transfers(self):
......@@ -312,7 +316,7 @@ class HistoryTableModel(QAbstractTableModel):
pubkey=self.connection.pubkey,
sha_hash=data[4],
)
transfer.conditions = data[7]
if transfer.state != Transaction.DROPPED:
if data[4] == STOPLINE_HASH:
self.transfers_data.append(self.data_stopline(transfer))
......@@ -327,6 +331,7 @@ class HistoryTableModel(QAbstractTableModel):
pubkey=self.connection.pubkey,
block_number=data[5],
)
dividend.conditions = data[7]
self.transfers_data.append(self.data_dividend(dividend))
self.endResetModel()
......@@ -334,7 +339,7 @@ class HistoryTableModel(QAbstractTableModel):
return len(self.transfers_data)
def columnCount(self, parent):
return len(HistoryTableModel.columns_types) - 6
return 4
def sort(self, main_column, order):
self.main_column_id = self.columns_types[main_column]
......@@ -374,7 +379,9 @@ class HistoryTableModel(QAbstractTableModel):
block_data = self.transfers_data[row][
HistoryTableModel.columns_types.index("block_number")
]
conditions_data = self.transfers_data[row][
HistoryTableModel.columns_types.index("conditions")
]
if state_data == Transaction.VALIDATED and block_data:
current_confirmations = (
self.blockchain_processor.current_buid(self.app.currency).number
......@@ -428,6 +435,9 @@ class HistoryTableModel(QAbstractTableModel):
font.setItalic(True)
else:
font.setItalic(False)
# if special lock conditions on a source coming from this transaction...
if conditions_data is not None:
font.setUnderline(True)
return font
if role == Qt.ForegroundRole:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment