further improvements for how transactions display

This commit is contained in:
Lucas Mathews
2024-05-26 23:36:35 +02:00
parent f1d3afb60c
commit 0732b26af3
2 changed files with 6 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
import tkinter as tk import tkinter as tk
from tkinter import messagebox, ttk from tkinter import ttk
import customtkinter import customtkinter
import json import json
from config import CONFIG from config import CONFIG
@@ -17,17 +17,6 @@ else:
print("Error: Account description not provided.") print("Error: Account description not provided.")
sys.exit(1) sys.exit(1)
def display_account_info():
response = get_account(account_id)
if response is None or 'data' not in response: # Check if the response is valid
print(f"Error: Unable to fetch account details for account {account_id}")
return
account = response['data']
print(type(account['balance'])) # Print the type of the balance
formatted_balance = format_balance(account['balance'])
account_info = (account['description'], account['account_id'], formatted_balance, account['account_type'])
return account_info
def populate_transactions_table(transactions_table, account_id): def populate_transactions_table(transactions_table, account_id):
response = get_transactions(account_id) # Fetch the transactions for the account response = get_transactions(account_id) # Fetch the transactions for the account
print(f"Response from get_transactions: {response}") # Print the response print(f"Response from get_transactions: {response}") # Print the response
@@ -38,6 +27,10 @@ def populate_transactions_table(transactions_table, account_id):
if not isinstance(transactions, list): if not isinstance(transactions, list):
print(f"Error: Expected a list of transactions, but got {type(transactions)}") print(f"Error: Expected a list of transactions, but got {type(transactions)}")
return return
# Sort transactions by timestamp in descending order
transactions.sort(key=lambda x: x['timestamp'], reverse=True)
for transaction in transactions: # Insert the transactions into the transactions_table for transaction in transactions: # Insert the transactions into the transactions_table
transactions_table.insert('', 'end', values=( transactions_table.insert('', 'end', values=(
transaction['transaction_id'], transaction['transaction_id'],

View File

@@ -1 +1 @@
{"session_cookie": {"session": "49JGnuF82p0Ed1I5QnnyXirNCJOY1g2EG7D5dO8C96I"}, "client_id": "31d90aad"} {"session_cookie": {"session": "snGl2pPHJKUmCdGIH4QdeIgGmzaPxjFZsUe30lxaMpk"}, "client_id": "31d90aad"}