Commit 2c3d462d authored by ntome's avatar ntome Committed by Romain Bignon

weboob.capabilities.bank: rename diff_percent and keep a compat alias

diff_percent was a misleading name because the ratio was expressed on 1,
not on 100, thus it wasn't a percentage.

For reference to suckers: a percentage is a ratio multiplied by 100.
We create a temporary alias so apps using the old field have compatibility.
"diff_percent" will soon be removed.
parent a0b4c191
......@@ -297,7 +297,7 @@ class Account(BaseAccount):
number = StringField('Shown by the bank to identify your account ie XXXXX7489')
# market and lifeinssurance accounts
valuation_diff = DecimalField('+/- values total')
valuation_diff_percent = DecimalField('+/- values ratio')
valuation_diff_ratio = DecimalField('+/- values ratio')
# parent account
# - A checking account parent of a card account
......@@ -311,6 +311,15 @@ class Account(BaseAccount):
def __repr__(self):
return "<%s id=%r label=%r>" % (type(self).__name__, self.id, self.label)
# compatibility alias
@property
def valuation_diff_percent(self):
return self.valuation_diff_ratio
@valuation_diff_percent.setter
def valuation_diff_percent(self, value):
self.valuation_diff_ratio = value
class Loan(Account):
"""
......@@ -450,7 +459,7 @@ class Investment(BaseObject):
valuation = DecimalField('Total current valuation of the Investment')
vdate = DateField('Value date of the valuation amount')
diff = DecimalField('Difference between the buy cost and the current valuation')
diff_percent = DecimalField('Difference in ratio (1 meaning 100%) between the buy cost and the current valuation')
diff_ratio = DecimalField('Difference in ratio (1 meaning 100%) between the buy cost and the current valuation')
portfolio_share = DecimalField('Ratio (1 meaning 100%) of the current amount relative to the total')
# International
......@@ -463,6 +472,15 @@ class Investment(BaseObject):
def __repr__(self):
return '<Investment label=%r code=%r valuation=%r>' % (self.label, self.code, self.valuation)
# compatibility alias
@property
def diff_percent(self):
return self.diff_ratio
@diff_percent.setter
def diff_percent(self, value):
self.diff_ratio = value
class PocketCondition(Enum):
UNKNOWN = 0
......
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