patch for users with no logs

This commit is contained in:
Expand-sys 2022-12-31 10:42:50 +11:00
parent 80c487ba39
commit 6d2559d2e4
2 changed files with 48 additions and 39 deletions

View file

@ -155,13 +155,15 @@ fastify.get(
Accept: "application/json",
},
});
console.log(log.body)
let transactionlog = []
let currentbal = balance;
log = JSON.parse(log.body);
let graphlog = log.reverse();
let graphdata = []
let final = []
let final2 = [];
if(log != null){
let graphlog = log.reverse();
console.log(graphlog)
console.log(`the previous thing should be a array`)
@ -170,22 +172,27 @@ fastify.get(
for(let i = 0; i < 16; i++) {
console.log(`itshiptobeesfuck`)
console.log(graphlog[i].amount)
let thingy
if(graphlog[i].amount >0 ){
thingy = parseInt(final[i]) + parseInt(graphlog[i].amount)
} else {
thingy = parseInt(final[i]) - parseInt(graphlog[i].amount)
let thingy = parseInt(final[i]) + parseInt(graphlog[i].amount)
final.push(`${thingy}`)
}
final.push(Math.abs(thingy))
}
console.log(`here`)
console.log(`${final}`)
final = final.reverse()
final.unshift(balance)
let final2 = [];
for(let i=0;i<final.length;i++){
final2.push([i, final[i]])
}
final2.unshift(["Transaction", "Amount"])
for(i = 0; i < 15; i++){
for(i = 0; i < log.length; i++){
if(log[i].amount > 0){
@ -200,14 +207,15 @@ fastify.get(
}
}
console.log(final)
}
console.log("begin render " + Date.now());
let maxgraph = balance + 1000;
stringgraphdata = JSON.stringify(final2)
let stringgraphdata = JSON.stringify(final2)
console.log(stringgraphdata)
graphdata = stringgraphdata.slice(1,stringgraphdata.length-1)
let graphdata = stringgraphdata.slice(1,stringgraphdata.length-1)
res.view("bankf", {
transactionlog: transactionlog,
maxgraph: maxgraph,

View file

@ -47,6 +47,7 @@ block content
p #{i}
#balhistory.tab-pane(role='tabpanel', aria-labelledby='balhistory-tab')
p Balance histroy is currently broken and we know this, please do not contact us about it, it is getting fixed
#chart_div(style="width:100%; height 100%")
script(type='text/javascript' src='https://www.gstatic.com/charts/loader.js')