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