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

Fixed a bug in Wallet tab with a non-member account

parent 1310cdfb
No related branches found
No related tags found
No related merge requests found
...@@ -38,20 +38,19 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): ...@@ -38,20 +38,19 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab):
parameters = self.community.parameters parameters = self.community.parameters
last_renewal = "" last_renewal = ""
expiration = "" expiration = ""
certifiers = 0
certified = 0
try: try:
person = Person.lookup(self.account.pubkey, self.community) person = Person.lookup(self.account.pubkey, self.community)
membership = person.membership(self.community) membership = person.membership(self.community)
certified = person.unique_valid_certified_by(self.community)
certifiers = person.unique_valid_certifiers_of(self.community)
renew_block = membership['blockNumber'] renew_block = membership['blockNumber']
last_renewal = self.community.get_block(renew_block).mediantime last_renewal = self.community.get_block(renew_block).mediantime
expiration = last_renewal + parameters['sigValidity'] expiration = last_renewal + parameters['sigValidity']
except MembershipNotFoundError: except MembershipNotFoundError:
pass last_renewal = None
expiration = None
certified = person.unique_valid_certified_by(self.community)
certifiers = person.unique_valid_certifiers_of(self.community)
if last_renewal and expiration:
date_renewal = QDateTime.fromTime_t(last_renewal).date().toString() date_renewal = QDateTime.fromTime_t(last_renewal).date().toString()
date_expiration = QDateTime.fromTime_t(expiration).date().toString() date_expiration = QDateTime.fromTime_t(expiration).date().toString()
# set infos in label # set infos in label
...@@ -67,7 +66,24 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): ...@@ -67,7 +66,24 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab):
"Membership", "Membership",
"Last renewal on {:}, expiration on {:}".format(date_renewal, date_expiration), "Last renewal on {:}, expiration on {:}".format(date_renewal, date_expiration),
"Your web of trust :", "Your web of trust :",
"Certified by : {0} members; Certifier of : {1} members".format(len(certifiers), "Certified by : {:} members; Certifier of : {:} members".format(len(certifiers),
len(certified))
)
)
else:
# set infos in label
self.label_general.setText(
"""
<table cellpadding="5">
<tr><td align="right"><b>{:}</b></td><td>{:}</td></tr>
<tr><td align="right"><b>{:}</b></td></tr>
<tr><td align="right"><b>{:}</b></td><td>{:}</td></tr>
</table>
""".format(
self.account.name, self.account.pubkey,
"Not a member",
"Your web of trust :",
"Certified by : {:} members; Certifier of : {:} members".format(len(certifiers),
len(certified)) len(certified))
) )
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment