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)
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":

View File

@ -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)
}
}
})
</script>