From 0497b37eabc439154483429db0d7eee02a250c35 Mon Sep 17 00:00:00 2001 From: Alexander Blair Date: Sat, 25 Feb 2017 12:08:37 -0800 Subject: [PATCH] Fixing sort to only be if not false Fixes #23 --- lib/api.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/api.js b/lib/api.js index b756c12..9d6e85f 100644 --- a/lib/api.js +++ b/lib/api.js @@ -355,8 +355,13 @@ app.get('/miner/:address/chart/hashrate', function (req, res) { app.get('/miner/:address/chart/hashrate/allWorkers', function (req, res) { let address = req.params.address; - let identifiers = global.database.getCache(address + '_identifiers').sort(); + let identifiers = global.database.getCache(address + '_identifiers'); let returnData = {global: global.database.getCache(req.params.address)['hashHistory']}; + if (identifiers !== false){ + identifiers.sort(); + } else { + return res.json(returnData); + } let intCounter = 0; identifiers.forEach(function(identifier){ returnData[identifier] = global.database.getCache(req.params.address+"_"+identifier)['hashHistory'];