From 359989f235e7978fef5866c0667c8e81cfc59b54 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Wed, 24 Apr 2019 13:45:56 +0100 Subject: [PATCH 1/3] Fix function name for total kredits issued/earned --- scripts/list-contributions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/list-contributions.js b/scripts/list-contributions.js index 56300c9..b320533 100644 --- a/scripts/list-contributions.js +++ b/scripts/list-contributions.js @@ -40,8 +40,8 @@ module.exports = async function(callback) { console.log(table.toString()); - let totalContributionBalances = await kredits.Contribution.functions.totalCount(true); - console.log(`Total confirmed balance: ${totalContributionBalances}`); + let totalKreditsEarned = await kredits.Contribution.functions.totalKreditsEarned(true); + console.log(`Total confirmed kredits: ${totalKreditsEarned}`); } catch (err) { console.log(err); } From 6b2ac15f561a0f4bcc5ec88a3457558161c6dd3b Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Wed, 24 Apr 2019 13:46:27 +0100 Subject: [PATCH 2/3] Improve error handling for list-contributors script --- scripts/list-contributors.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/scripts/list-contributors.js b/scripts/list-contributors.js index 235fffb..88cc126 100644 --- a/scripts/list-contributors.js +++ b/scripts/list-contributors.js @@ -21,24 +21,24 @@ module.exports = async function(callback) { try { const contributors = await kredits.Contributor.all() + + contributors.forEach((c) => { + table.push([ + c.id.toString(), + c.account, + `${c.name}`, + c.isCore, + ethers.utils.formatEther(c.balance), + c.totalKreditsEarned.toString(), + c.contributionsCount.toString(), + c.ipfsHash + ]) + }) } catch(e) { callback(e); return; } - contributors.forEach((c) => { - table.push([ - c.id.toString(), - c.account, - `${c.name}`, - c.isCore, - ethers.utils.formatEther(c.balance), - c.totalKreditsEarned.toString(), - c.contributionsCount.toString(), - c.ipfsHash - ]) - }) - console.log(table.toString()) callback() From 6f53c8097ec4a12469d9e190c91199d3af762141 Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Wed, 24 Apr 2019 14:55:35 +0200 Subject: [PATCH 3/3] Wrap anything that could break in the try/catch block --- scripts/list-contributors.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/list-contributors.js b/scripts/list-contributors.js index 88cc126..ecb5e8c 100644 --- a/scripts/list-contributors.js +++ b/scripts/list-contributors.js @@ -34,13 +34,12 @@ module.exports = async function(callback) { c.ipfsHash ]) }) + + console.log(table.toString()) } catch(e) { callback(e); return; } - console.log(table.toString()) - callback() } -