diff --git a/index.js b/index.js index 0ef5bbe..7c9ed57 100644 --- a/index.js +++ b/index.js @@ -155,59 +155,67 @@ 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 = [] - - console.log(graphlog) - console.log(`the previous thing should be a array`) - final.push(parseInt(balance)) - console.log(final) - for(let i = 0; i < 16; i++) { - console.log(`itshiptobeesfuck`) - console.log(graphlog[i].amount) - - let thingy = parseInt(final[i]) + parseInt(graphlog[i].amount) - final.push(`${thingy}`) - } - console.log(`here`) - console.log(`${final}`) - final = final.reverse() - final.unshift(balance) let final2 = []; - for(let i=0;i 0){ - let absol = Math.abs(log[i].amount) - let date = new Date(log[i].time * 1000) - transactionlog.push(`You sent ${log[i].counterparty} ${absol} at ${date}`); - - } else { - let date = new Date(log[i].time * 1000) - let absol = Math.abs(log[i].amount) - transactionlog.push(`${log[i].counterparty} sent you ${absol} at ${date}`); - + console.log(graphlog) + console.log(`the previous thing should be a array`) + final.push(parseInt(balance)) + console.log(final) + 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) + + } + + final.push(Math.abs(thingy)) + } + console.log(`here`) + console.log(`${final}`) + final = final.reverse() + final.unshift(balance) + for(let i=0;i 0){ + let absol = Math.abs(log[i].amount) + let date = new Date(log[i].time * 1000) + transactionlog.push(`You sent ${log[i].counterparty} ${absol} at ${date}`); + + } else { + let date = new Date(log[i].time * 1000) + let absol = Math.abs(log[i].amount) + transactionlog.push(`${log[i].counterparty} sent you ${absol} at ${date}`); + + } } } - 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, diff --git a/views/bankf.pug b/views/bankf.pug index 77586ef..ce5f05b 100644 --- a/views/bankf.pug +++ b/views/bankf.pug @@ -46,7 +46,8 @@ block content hr p #{i} - #balhistory.tab-pane(role='tabpanel', aria-labelledby='balhistory-tab') + #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')