From f46046b7a666e1e6e1ddd353cad798ee0026dfb7 Mon Sep 17 00:00:00 2001 From: sisou Date: Fri, 20 Apr 2018 10:02:58 -0600 Subject: [PATCH] Formatting --- Helper.js | 54 +++++++++++++++++++++++++------------------------- PoolService.js | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Helper.js b/Helper.js index 63c1411..860547f 100644 --- a/Helper.js +++ b/Helper.js @@ -21,33 +21,33 @@ class Helper { */ static async getUserBalance(config, connectionPool, userId, currChainHeight, includeVirtual = false) { const query = ` - SELECT t1.user AS user, IFNULL(payin_sum, 0) - IFNULL(payout_sum, 0) AS balance - FROM ( - ( - SELECT user, SUM(amount) AS payin_sum - FROM ( - ( - SELECT user, block, amount - FROM payin - WHERE user=? - ) t3 - INNER JOIN - ( - SELECT id, height - FROM block - WHERE height <= ? - ) t4 - ON t4.id = t3.block - ) - ) t1 - LEFT JOIN - ( - SELECT user, SUM(amount) AS payout_sum - FROM payout - WHERE user=? - ) t2 - ON t1.user = t2.user - ) + SELECT t1.user AS user, IFNULL(payin_sum, 0) - IFNULL(payout_sum, 0) AS balance + FROM ( + ( + SELECT user, SUM(amount) AS payin_sum + FROM ( + ( + SELECT user, block, amount + FROM payin + WHERE user=? + ) t3 + INNER JOIN + ( + SELECT id, height + FROM block + WHERE height <= ? + ) t4 + ON t4.id = t3.block + ) + ) t1 + LEFT JOIN + ( + SELECT user, SUM(amount) AS payout_sum + FROM payout + WHERE user=? + ) t2 + ON t1.user = t2.user + ) `; const queryHeight = includeVirtual ? currChainHeight : currChainHeight - config.payoutConfirmations; const queryArgs = [userId, queryHeight, userId]; diff --git a/PoolService.js b/PoolService.js index b53a324..e90267f 100644 --- a/PoolService.js +++ b/PoolService.js @@ -93,7 +93,7 @@ class PoolService extends Nimiq.Observable { LIMIT ? ) t3 GROUP BY user - `; + `; const queryArgs = [lastBlock.height, n]; const [rows, fields] = await this.connectionPool.execute(query, queryArgs);