From 8720a0faabdf073abb59ddbe5aeedbec682d70bb Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Fri, 10 May 2019 13:45:54 +0200 Subject: [PATCH 1/2] Add failing test for vetoed in confirmed list --- tests/fixtures/contributions.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/fixtures/contributions.js b/tests/fixtures/contributions.js index 1d92d92..2fc2f13 100644 --- a/tests/fixtures/contributions.js +++ b/tests/fixtures/contributions.js @@ -8,9 +8,10 @@ const data = [ { id: 3, contributorId: 2, confirmedAtBlock: 1000, claimed: false, vetoed: false, amount: 1500 }, { id: 4, contributorId: 2, confirmedAtBlock: 1000, claimed: false, vetoed: false, amount: 1500 }, { id: 5, contributorId: 1, confirmedAtBlock: 1000, claimed: false, vetoed: false, amount: 5000 }, - { id: 6, contributorId: 3, confirmedAtBlock: 2000, claimed: false, vetoed: false, amount: 5000 }, - { id: 7, contributorId: 1, confirmedAtBlock: 2000, claimed: false, vetoed: false, amount: 1500 }, - { id: 8, contributorId: 3, confirmedAtBlock: 2000, claimed: false, vetoed: true, amount: 1500 }, + { id: 6, contributorId: 1, confirmedAtBlock: 1000, claimed: false, vetoed: true, amount: 500 }, + { id: 7, contributorId: 3, confirmedAtBlock: 2000, claimed: false, vetoed: false, amount: 5000 }, + { id: 8, contributorId: 1, confirmedAtBlock: 2000, claimed: false, vetoed: false, amount: 1500 }, + { id: 9, contributorId: 3, confirmedAtBlock: 2000, claimed: false, vetoed: true, amount: 1500 }, ]; data.forEach(attrs => items.push(Model.create(attrs))); From 7083da367de7f9a1ae4b78a7d7c962b32030e1d4 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Fri, 10 May 2019 13:49:55 +0200 Subject: [PATCH 2/2] Remove vetoed contributions from confirmed list --- app/services/kredits.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/services/kredits.js b/app/services/kredits.js index 8653071..2eee5c0 100644 --- a/app/services/kredits.js +++ b/app/services/kredits.js @@ -40,9 +40,11 @@ export default Service.extend({ }), contributionsConfirmed: computed('contributions.[]', 'currentBlock', function() { - return this.contributions.filter(contribution => { - return contribution.confirmedAt <= this.currentBlock; - }); + return this.contributions + .filterBy('vetoed', false) + .filter(contribution => { + return contribution.confirmedAt <= this.currentBlock; + }); }), kreditsByContributor: computed('contributionsUnconfirmed.@each.vetoed', 'contributors', function() {