Skip to content
Snippets Groups Projects
Commit b438efa4 authored by inso's avatar inso
Browse files

Display back confirmations in wot tabs

parent 35ada037
No related branches found
No related tags found
No related merge requests found
......@@ -56,7 +56,7 @@ class BaseGraph(QObject):
node_status += NodeStatus.OUT
return node_status
async def confirmation_text(self, block_number):
def confirmation_text(self, block_number):
"""
Build confirmation text of an arc
:param int block_number: the block number of the certification
......@@ -107,7 +107,7 @@ class BaseGraph(QObject):
QLocale.dateFormat(QLocale(), QLocale.ShortFormat)
),
'cert_time': certifier['cert_time'],
'confirmation_text': (await self.confirmation_text(certifier['cert_time']))
'confirmation_text': self.confirmation_text(certifier['block_number'])
}
self.nx_graph.add_edge(certifier['identity'].pubkey, identity.pubkey, attr_dict=arc, weight=len(certifier_list))
......@@ -145,7 +145,7 @@ class BaseGraph(QObject):
QLocale.dateFormat(QLocale(), QLocale.ShortFormat)
),
'cert_time': certified['cert_time'],
'confirmation_text': (await self.confirmation_text(certified['cert_time']))
'confirmation_text': self.confirmation_text(certified['block_number'])
}
self.nx_graph.add_edge(identity.pubkey, certified['identity'].pubkey, attr_dict=arc,
......
......@@ -274,9 +274,12 @@ class Network(QObject):
:return: the number of confirmations of a data
:rtype: int
"""
if block_number > self.current_blockid.number:
raise ValueError("Could not compute confirmations : data block number is after current block")
return self.current_blockid.number - block_number + 1
if block_number:
if block_number > self.current_blockid.number:
raise ValueError("Could not compute confirmations : data block number is after current block")
return self.current_blockid.number - block_number + 1
else:
return 0
def add_node(self, node):
"""
......
......@@ -76,10 +76,7 @@ class TestBaseGraph(unittest.TestCase, QuamashTest):
base_graph = BaseGraph(app, community)
async def exec_test():
self.assertEquals((await base_graph.confirmation_text(200)), "2/6")
self.lp.run_until_complete(exec_test())
self.assertEquals(base_graph.confirmation_text(200), "2/6")
@patch('sakia.core.Application')
@patch('sakia.core.Community')
......@@ -89,10 +86,7 @@ class TestBaseGraph(unittest.TestCase, QuamashTest):
base_graph = BaseGraph(app, community)
async def exec_test():
self.assertEquals((await base_graph.confirmation_text(200)), "33 %")
self.lp.run_until_complete(exec_test())
self.assertEquals(base_graph.confirmation_text(200), "33 %")
@patch('sakia.core.Community')
@patch('sakia.core.Application')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment