Corrects statement and token listing.
This commit is contained in:
parent
22e142a2e3
commit
5f064bf713
@ -89,21 +89,25 @@ class MenuProcessor:
|
|||||||
:rtype:
|
:rtype:
|
||||||
"""
|
"""
|
||||||
cached_statement = get_cached_statement(self.account.blockchain_address)
|
cached_statement = get_cached_statement(self.account.blockchain_address)
|
||||||
statement = json.loads(cached_statement)
|
transaction_sets = []
|
||||||
statement_transactions = parse_statement_transactions(statement)
|
if cached_statement:
|
||||||
transaction_sets = [statement_transactions[tx:tx + 3] for tx in range(0, len(statement_transactions), 3)]
|
statement = json.loads(cached_statement)
|
||||||
|
statement_transactions = parse_statement_transactions(statement)
|
||||||
|
transaction_sets = [statement_transactions[tx:tx + 3] for tx in range(0, len(statement_transactions), 3)]
|
||||||
preferred_language = get_cached_preferred_language(self.account.blockchain_address)
|
preferred_language = get_cached_preferred_language(self.account.blockchain_address)
|
||||||
if not preferred_language:
|
if not preferred_language:
|
||||||
preferred_language = i18n.config.get('fallback')
|
preferred_language = i18n.config.get('fallback')
|
||||||
first_transaction_set = []
|
no_transaction_history = statement_transaction_set(preferred_language, transaction_sets)
|
||||||
middle_transaction_set = []
|
first_transaction_set = no_transaction_history
|
||||||
last_transaction_set = []
|
middle_transaction_set = no_transaction_history
|
||||||
|
last_transaction_set = no_transaction_history
|
||||||
if transaction_sets:
|
if transaction_sets:
|
||||||
first_transaction_set = statement_transaction_set(preferred_language, transaction_sets[0])
|
first_transaction_set = statement_transaction_set(preferred_language, transaction_sets[0])
|
||||||
if len(transaction_sets) >= 2:
|
if len(transaction_sets) >= 2:
|
||||||
middle_transaction_set = statement_transaction_set(preferred_language, transaction_sets[1])
|
middle_transaction_set = statement_transaction_set(preferred_language, transaction_sets[1])
|
||||||
if len(transaction_sets) >= 3:
|
if len(transaction_sets) >= 3:
|
||||||
last_transaction_set = statement_transaction_set(preferred_language, transaction_sets[2])
|
last_transaction_set = statement_transaction_set(preferred_language, transaction_sets[2])
|
||||||
|
|
||||||
if self.display_key == 'ussd.kenya.first_transaction_set':
|
if self.display_key == 'ussd.kenya.first_transaction_set':
|
||||||
return translation_for(
|
return translation_for(
|
||||||
self.display_key, preferred_language, first_transaction_set=first_transaction_set
|
self.display_key, preferred_language, first_transaction_set=first_transaction_set
|
||||||
@ -124,9 +128,10 @@ class MenuProcessor:
|
|||||||
preferred_language = get_cached_preferred_language(self.account.blockchain_address)
|
preferred_language = get_cached_preferred_language(self.account.blockchain_address)
|
||||||
if not preferred_language:
|
if not preferred_language:
|
||||||
preferred_language = i18n.config.get('fallback')
|
preferred_language = i18n.config.get('fallback')
|
||||||
first_account_tokens_set = []
|
no_token_list = token_list_set(preferred_language, [])
|
||||||
middle_account_tokens_set = []
|
first_account_tokens_set = no_token_list
|
||||||
last_account_tokens_set = []
|
middle_account_tokens_set = no_token_list
|
||||||
|
last_account_tokens_set = no_token_list
|
||||||
if token_list_sets:
|
if token_list_sets:
|
||||||
data = {
|
data = {
|
||||||
'account_tokens_list': cached_token_data_list
|
'account_tokens_list': cached_token_data_list
|
||||||
|
Loading…
Reference in New Issue
Block a user