From e69539957ed0ae99b3522f3584c51a92a1dfe971 Mon Sep 17 00:00:00 2001 From: Oliver Boehlk Date: Fri, 29 May 2020 18:59:22 +0200 Subject: [PATCH] fix NaN bug --- largefetch.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/largefetch.js b/largefetch.js index 8b86197..f4e3c49 100644 --- a/largefetch.js +++ b/largefetch.js @@ -39,8 +39,8 @@ const getFullData = async url => { if (marketData.status === 200) { marketData = await marketData.json(); let foundQ = [false, false, false, false, false, false, false]; - let mCapSum = [0, 0, 0, 0, 0, 0, 0]; - let mCapCount = [0, 0, 0, 0, 0, 0, 0]; + let mCapSum = [0, 0, 0, 0, 0, 0, 0, 0]; + let mCapCount = [0, 0, 0, 0, 0, 0, 0, 0]; let res = []; for (let t2 = 0; t2 < marketData.length; t2++) { if (marketData[t2].quality <= 7) { @@ -112,16 +112,17 @@ const storeFullData = async marketData => { connection.commit(function (err) { if (err) { + tgBot.sendMessage(tgInfo.debugChat, 'ERROR: commit failed.'); return connection.rollback(function () { connection.end(); throw err; }); } else { - connection.end(); + tgBot.sendMessage(tgInfo.debugChat, 'INF: dataminer successfully stored new prices.'); + return connection.end(); } }); }); - tgBot.sendMessage(tgInfo.debugChat, 'INF: dataminer successfully stored new prices.'); } storeFullData(getFullData());