Spagetthi, needs cleaning and refactor

This commit is contained in:
ben 2022-12-15 11:16:19 +00:00
parent cde7e4a5e9
commit eb9ec21c89
2 changed files with 15 additions and 20 deletions

View file

@ -437,8 +437,9 @@ async def get_screen_data(screen_num: int, screens_list: dict, gerty):
areas = await get_dashboard(gerty) areas = await get_dashboard(gerty)
if screen_slug == "lnbits_wallets_balance": if screen_slug == "lnbits_wallets_balance":
wallets = await get_lnbits_wallet_balances(gerty) wallets = await get_lnbits_wallet_balances(gerty)
text = []
for wallet in wallets: for wallet in wallets:
text = []
text.append( text.append(
get_text_item_dict( get_text_item_dict(
text="{0}'s Wallet".format(wallet["name"]), 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, gerty_type=gerty.type,
) )
) )
areas.append(text) areas.append(text)
elif screen_slug == "fun_satoshi_quotes": elif screen_slug == "fun_satoshi_quotes":
areas.append(await get_satoshi_quotes(gerty)) areas.append(await get_satoshi_quotes(gerty))
elif screen_slug == "fun_exchange_market_rate": elif screen_slug == "fun_exchange_market_rate":

View file

@ -40,7 +40,7 @@ endblock %}{% block page %} {% raw %}
data: function () { data: function () {
return { return {
lnbits_wallets_balance: {}, lnbits_wallets_balance: {},
dashboard: {}, onchain: {},
fun_satoshi_quotes: {}, fun_satoshi_quotes: {},
fun_exchange_market_rate: {}, fun_exchange_market_rate: {},
gerty: [], gerty: [],
@ -83,23 +83,22 @@ endblock %}{% block page %} {% raw %}
}, },
created: async function () { created: async function () {
await this.getGertyInfo() await this.getGertyInfo()
console.log(this.gerty.length) console.log(this.gerty)
for (let i = 0; i < this.gerty.length; i++) { 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"){ if(this.gerty[i].screen.group == "lnbits_wallets_balance"){
for (let i = 0; i < this.gerty[i].screen.areas.length; i++) { for (let q = 0; q < this.gerty[i].screen.areas.length; q++) {
this.lnbits_wallets_balance[i] = { this.lnbits_wallets_balance[q] = {
"name": this.gerty[i].screen.areas[i][0].value, "name": this.gerty[i].screen.areas[q][0].value,
"amount": this.gerty[i].screen.areas[i][1].value, "amount": this.gerty[i].screen.areas[q][1].value,
"color1": this.walletColors[i].first, "color1": this.walletColors[q].first,
"color2": this.walletColors[i].second, "color2": this.walletColors[q].second,
} }
this.gertyname = this.gerty[i].settings.name this.gertyname = this.gerty[i].settings.name
} }
console.log(this.lnbits_wallets_balance)
} }
if(this.gerty[i].screen.group == "dashboard"){ if(this.gerty[i].screen.group == "onchain"){
this.dashboard = this.gerty[i].screen.areas this.onchain = this.gerty[i].screen.areas
console.log(this.onchain)
} }
if(this.gerty[i].screen.group == "fun_satoshi_quotes"){ if(this.gerty[i].screen.group == "fun_satoshi_quotes"){
this.fun_satoshi_quotes["quote"] = this.gerty[i].screen.areas[0][0].value this.fun_satoshi_quotes["quote"] = this.gerty[i].screen.areas[0][0].value
@ -112,11 +111,6 @@ endblock %}{% block page %} {% raw %}
this.gertyname = this.gerty[i].settings.name this.gertyname = this.gerty[i].settings.name
} }
} }
console.log(this.gerty)
console.log(this.gertywallets)
} }
}) })
</script> </script>