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

Dividend is now a Community property

parent fa35b126
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,7 @@ def quantitative(units, community):
def relative(units, community):
ud = community.dividend()
ud = community.dividend
relative_value = units / float(ud)
return relative_value
......@@ -38,7 +38,7 @@ def quantitative_zerosum(units, community):
def relative_zerosum(units, community):
median = community.monetary_mass / community.nb_members
ud = community.dividend()
ud = community.dividend
relative_value = units / float(ud)
relative_median = median / ud
return relative_value - relative_median
......
......@@ -140,14 +140,15 @@ class Community(object):
u = ord('\u24B6') + ord(letter) - ord('A')
return chr(u)
@property
def dividend(self):
block = self.get_ud_block()
block = self._ud_block()
if block:
return block['dividend']
else:
return 1
def get_ud_block(self):
def _ud_block(self):
ud = self.request(bma.blockchain.UD)
if len(ud['result']['blocks']) > 0:
block_number = ud['result']['blocks'][-1]
......
......@@ -199,7 +199,7 @@ class Wallet(object):
def relative_value(self, community):
value = self.value(community)
ud = community.dividend()
ud = community.dividend
relative_value = value / float(ud)
return relative_value
......
......@@ -29,7 +29,7 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog):
self.wallet = None
self.community = self.sender.communities[0]
self.wallet = self.sender.wallets[0]
self.dividend = self.community.dividend()
self.dividend = self.community.dividend
for community in self.sender.communities:
self.combo_community.addItem(community.currency)
......@@ -103,7 +103,7 @@ Please try again later""")
def change_current_community(self, index):
self.community = self.sender.communities[index]
self.dividend = self.community.dividend()
self.dividend = self.community.dividend
amount = self.wallet.value(self.community)
ref_amount = self.sender.units_to_ref(amount, self.community)
ref_name = self.sender.ref_name(self.community.currency)
......
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