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

Fix bug #524

parent b0d366c6
No related branches found
No related tags found
No related merge requests found
...@@ -169,7 +169,6 @@ class Community(QObject): ...@@ -169,7 +169,6 @@ class Community(QObject):
else: else:
return None return None
except errors.DuniterError as e: except errors.DuniterError as e:
if e.ucode == errors.BLOCK_NOT_FOUND:
logging.debug(str(e)) logging.debug(str(e))
return None return None
except NoPeerAvailable as e: except NoPeerAvailable as e:
......
...@@ -96,6 +96,13 @@ class RelativeToPast(BaseReferential): ...@@ -96,6 +96,13 @@ class RelativeToPast(BaseReferential):
from . import Relative from . import Relative
value = await self.differential() value = await self.differential()
block = await self.community.get_ud_block(0, self._block_number) block = await self.community.get_ud_block(0, self._block_number)
if block:
date = QLocale.toString(
QLocale(),
QDateTime.fromTime_t(block['medianTime']).date(),
QLocale.dateFormat(QLocale(), QLocale.ShortFormat))
else:
date = "###"
prefix = "" prefix = ""
if international_system and value != 0: if international_system and value != 0:
localized_value, prefix = Relative.to_si(value, self.app.preferences['digits_after_comma']) localized_value, prefix = Relative.to_si(value, self.app.preferences['digits_after_comma'])
...@@ -104,13 +111,7 @@ class RelativeToPast(BaseReferential): ...@@ -104,13 +111,7 @@ class RelativeToPast(BaseReferential):
if units or international_system: if units or international_system:
return QCoreApplication.translate("RelativeToPast", RelativeToPast._REF_STR_)\ return QCoreApplication.translate("RelativeToPast", RelativeToPast._REF_STR_)\
.format(localized_value, .format(localized_value,prefix,date,
prefix,
QLocale.toString(
QLocale(),
QDateTime.fromTime_t(block['medianTime']).date(),
QLocale.dateFormat(QLocale(), QLocale.ShortFormat)
),
self.community.short_currency if units else "") self.community.short_currency if units else "")
else: else:
return localized_value return localized_value
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment