Display contribution balances not token balances #107
@@ -6,7 +6,7 @@
|
||||
{{contributor.name}}
|
||||
</td>
|
||||
<td class="kredits">
|
||||
<span class="amount">{{contributor.balance}}</span>
|
||||
<span class="amount">{{contributor.totalKreditsEarned}}</span>
|
||||
<span class="symbol">₭S</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -9,9 +9,9 @@ export default Controller.extend({
|
||||
|
||||
contributors: alias('kredits.contributors'),
|
||||
contributorsWithKredits: filter('contributors', function(contributor) {
|
||||
return contributor.get('balanceRaw').gt(0);
|
||||
return contributor.get('totalKreditsEarnedRaw').gt(0);
|
||||
}),
|
||||
contributorsSorting: Object.freeze(['balance:desc']),
|
||||
contributorsSorting: Object.freeze(['totalKreditsEarned:desc']),
|
||||
contributorsSorted: sort('contributorsWithKredits', 'contributorsSorting'),
|
||||
|
||||
contributions: alias('kredits.contributions'),
|
||||
|
||||
@@ -8,6 +8,8 @@ export default EmberObject.extend({
|
||||
id: bignumber('idRaw', 'toString'),
|
||||
account: null,
|
||||
balance: kreditsValue('balanceRaw'),
|
||||
totalKreditsEarned: bignumber('totalKreditsEarnedRaw', 'toNumber'),
|
||||
contributionsCount: bignumber('contributionsCountRaw', 'toNumber'),
|
||||
isCore: false,
|
||||
ipfsHash: null,
|
||||
|
||||
|
||||
@@ -116,6 +116,14 @@ export default Service.extend({
|
||||
})
|
||||
|
|
||||
}),
|
||||
|
||||
totalKreditsEarned: computed(function() {
|
||||
return this.kredits.Contribution.functions.totalKreditsEarned(true)
|
||||
|
Not a fan of the unnamed Not a fan of the unnamed `true` in this new function call, because the meaning is completely hidden, until one finds and reads the Solidity source code of it.
yes, me neither. but it is a contract call and generated from the wrapper. yes, me neither. but it is a contract call and generated from the wrapper.
could at some write our own function in the wrapper class.
Ah, yes. Ah, yes.
|
||||
.then(total => {
|
||||
return total.toNumber();
|
||||
});
|
||||
}),
|
||||
|
||||
|
||||
loadInitialData() {
|
||||
return this.getContributors()
|
||||
.then(contributors => this.contributors.pushObjects(contributors))
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{{contributor-list contributors=contributorsSorted}}
|
||||
|
||||
<p class="stats">
|
||||
<span class="number">{{await kredits.totalSupply}}</span> kredits issued and distributed among
|
||||
<span class="number">{{await kredits.totalKreditsEarned}}</span> kredits issued and distributed among
|
||||
<span class="number">{{contributorsWithKredits.length}}</span> contributors.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -8,10 +8,10 @@ module('Unit | Controller | index', function(hooks) {
|
||||
|
||||
let addFixtures = function(controller) {
|
||||
[
|
||||
{ github_username: "neo", github_uid: "318", balance: 10000 },
|
||||
{ github_username: "morpheus", github_uid: "843", balance: 15000 },
|
||||
{ github_username: "trinity", github_uid: "123", balance: 5000 },
|
||||
{ github_username: "mouse", github_uid: "696", balance: 0 }
|
||||
{ github_username: "neo", github_uid: "318", totalKreditsEarned: 10000 },
|
||||
{ github_username: "morpheus", github_uid: "843", totalKreditsEarned: 15000 },
|
||||
{ github_username: "trinity", github_uid: "123", totalKreditsEarned: 5000 },
|
||||
{ github_username: "mouse", github_uid: "696", totalKreditsEarned: 0 }
|
||||
].forEach(fixture => {
|
||||
controller.get('kredits.contributors').push(Contributor.create(fixture));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user
Can be written more concise: