From eb9ec21c89a338dd2b605350592994f3c4e7ace7 Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 15 Dec 2022 11:16:19 +0000 Subject: [PATCH] Spagetthi, needs cleaning and refactor --- lnbits/extensions/gerty/helpers.py | 5 ++-- .../gerty/templates/gerty/gerty.html | 30 ++++++++----------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/lnbits/extensions/gerty/helpers.py b/lnbits/extensions/gerty/helpers.py index 1dfe9d04a..82eac1500 100644 --- a/lnbits/extensions/gerty/helpers.py +++ b/lnbits/extensions/gerty/helpers.py @@ -437,8 +437,9 @@ async def get_screen_data(screen_num: int, screens_list: dict, gerty): areas = await get_dashboard(gerty) if screen_slug == "lnbits_wallets_balance": wallets = await get_lnbits_wallet_balances(gerty) - text = [] + for wallet in wallets: + text = [] text.append( get_text_item_dict( text="{0}'s Wallet".format(wallet["name"]), @@ -453,7 +454,7 @@ async def get_screen_data(screen_num: int, screens_list: dict, gerty): gerty_type=gerty.type, ) ) - areas.append(text) + areas.append(text) elif screen_slug == "fun_satoshi_quotes": areas.append(await get_satoshi_quotes(gerty)) elif screen_slug == "fun_exchange_market_rate": diff --git a/lnbits/extensions/gerty/templates/gerty/gerty.html b/lnbits/extensions/gerty/templates/gerty/gerty.html index 03418ab90..fa5aacfef 100644 --- a/lnbits/extensions/gerty/templates/gerty/gerty.html +++ b/lnbits/extensions/gerty/templates/gerty/gerty.html @@ -40,7 +40,7 @@ endblock %}{% block page %} {% raw %} data: function () { return { lnbits_wallets_balance: {}, - dashboard: {}, + onchain: {}, fun_satoshi_quotes: {}, fun_exchange_market_rate: {}, gerty: [], @@ -83,23 +83,22 @@ endblock %}{% block page %} {% raw %} }, created: async function () { await this.getGertyInfo() - console.log(this.gerty.length) + console.log(this.gerty) for (let i = 0; i < this.gerty.length; i++) { - console.log(this.gerty[i].screen.group) if(this.gerty[i].screen.group == "lnbits_wallets_balance"){ - for (let i = 0; i < this.gerty[i].screen.areas.length; i++) { - this.lnbits_wallets_balance[i] = { - "name": this.gerty[i].screen.areas[i][0].value, - "amount": this.gerty[i].screen.areas[i][1].value, - "color1": this.walletColors[i].first, - "color2": this.walletColors[i].second, + for (let q = 0; q < this.gerty[i].screen.areas.length; q++) { + this.lnbits_wallets_balance[q] = { + "name": this.gerty[i].screen.areas[q][0].value, + "amount": this.gerty[i].screen.areas[q][1].value, + "color1": this.walletColors[q].first, + "color2": this.walletColors[q].second, } this.gertyname = this.gerty[i].settings.name } - console.log(this.lnbits_wallets_balance) } - if(this.gerty[i].screen.group == "dashboard"){ - this.dashboard = this.gerty[i].screen.areas + if(this.gerty[i].screen.group == "onchain"){ + this.onchain = this.gerty[i].screen.areas + console.log(this.onchain) } if(this.gerty[i].screen.group == "fun_satoshi_quotes"){ this.fun_satoshi_quotes["quote"] = this.gerty[i].screen.areas[0][0].value @@ -111,12 +110,7 @@ endblock %}{% block page %} {% raw %} this.fun_exchange_market_rate["amount"] = this.gerty[i].screen.areas[0][1].value this.gertyname = this.gerty[i].settings.name } - } - - console.log(this.gerty) - - - console.log(this.gertywallets) + } } })