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

Merge branch 'dev' of github.com:duniter/sakia into dev

parents 5bcd970f 6f749be8
Branches
No related tags found
No related merge requests found
import asyncio import asyncio
import logging import logging
import hashlib import hashlib
import math
from duniterpy.documents.transaction import SimpleTransaction from duniterpy.documents.transaction import SimpleTransaction
from duniterpy.documents.block import Block from duniterpy.documents.block import Block
from duniterpy.api import bma, errors from duniterpy.api import bma, errors
...@@ -9,7 +10,7 @@ from .net.network import MAX_CONFIRMATIONS ...@@ -9,7 +10,7 @@ from .net.network import MAX_CONFIRMATIONS
from ..tools.exceptions import LookupFailureError, NoPeerAvailable from ..tools.exceptions import LookupFailureError, NoPeerAvailable
class TxHistory(): class TxHistory:
def __init__(self, app, wallet): def __init__(self, app, wallet):
self._latest_block = 0 self._latest_block = 0
self.wallet = wallet self.wallet = wallet
...@@ -169,7 +170,7 @@ class TxHistory(): ...@@ -169,7 +170,7 @@ class TxHistory():
if o.conditions.left.pubkey != self.wallet.pubkey] if o.conditions.left.pubkey != self.wallet.pubkey]
amount = 0 amount = 0
for o in outputs: for o in outputs:
amount += o.amount amount += o.amount * math.pow(10, o.base)
metadata['amount'] = amount metadata['amount'] = amount
transfer = Transfer.create_from_blockchain(tx_hash, transfer = Transfer.create_from_blockchain(tx_hash,
blockUID, blockUID,
...@@ -182,7 +183,7 @@ class TxHistory(): ...@@ -182,7 +183,7 @@ class TxHistory():
if o.conditions.left.pubkey == self.wallet.pubkey] if o.conditions.left.pubkey == self.wallet.pubkey]
amount = 0 amount = 0
for o in outputs: for o in outputs:
amount += o.amount amount += o.amount * math.pow(10, o.base)
metadata['amount'] = amount metadata['amount'] = amount
transfer = Transfer.create_from_blockchain(tx_hash, transfer = Transfer.create_from_blockchain(tx_hash,
......
...@@ -5,6 +5,7 @@ Created on 31 janv. 2015 ...@@ -5,6 +5,7 @@ Created on 31 janv. 2015
""" """
import logging import logging
import math
from PyQt5.QtCore import QLocale, QDateTime, QEvent from PyQt5.QtCore import QLocale, QDateTime, QEvent
from PyQt5.QtWidgets import QWidget from PyQt5.QtWidgets import QWidget
from ..gen_resources.informations_tab_uic import Ui_InformationsTabWidget from ..gen_resources.informations_tab_uic import Ui_InformationsTabWidget
...@@ -77,7 +78,7 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget): ...@@ -77,7 +78,7 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
if block_ud: if block_ud:
# display float values # display float values
localized_ud = await self.account.current_ref.instance(block_ud['dividend'], localized_ud = await self.account.current_ref.instance(block_ud['dividend'] * math.pow(10, block_ud['unitbase']),
self.community, self.community,
self.app) \ self.app) \
.diff_localized(True, self.app.preferences['international_system_of_units']) .diff_localized(True, self.app.preferences['international_system_of_units'])
...@@ -117,7 +118,7 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget): ...@@ -117,7 +118,7 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
if block_ud['membersCount'] == 0 or block_ud_minus_1['monetaryMass'] == 0: if block_ud['membersCount'] == 0 or block_ud_minus_1['monetaryMass'] == 0:
actual_growth = float(0) actual_growth = float(0)
else: else:
actual_growth = block_ud['dividend'] / (block_ud_minus_1['monetaryMass'] / block_ud['membersCount']) actual_growth = (block_ud['dividend'] * math.pow(10, block_ud['unitbase'])) / (block_ud_minus_1['monetaryMass'] / block_ud['membersCount'])
localized_ud_median_time_minus_1 = QLocale.toString( localized_ud_median_time_minus_1 = QLocale.toString(
QLocale(), QLocale(),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment