Display contribution balances not token balances
We want to display the contribution balances (kredits earned) of the contributors not the token balances.
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
{{contributor.name}}
|
{{contributor.name}}
|
||||||
</td>
|
</td>
|
||||||
<td class="kredits">
|
<td class="kredits">
|
||||||
<span class="amount">{{contributor.balance}}</span>
|
<span class="amount">{{contributor.totalKreditsEarned}}</span>
|
||||||
<span class="symbol">₭S</span>
|
<span class="symbol">₭S</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ export default Controller.extend({
|
|||||||
|
|
||||||
contributors: alias('kredits.contributors'),
|
contributors: alias('kredits.contributors'),
|
||||||
contributorsWithKredits: filter('contributors', function(contributor) {
|
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'),
|
contributorsSorted: sort('contributorsWithKredits', 'contributorsSorting'),
|
||||||
|
|
||||||
contributions: alias('kredits.contributions'),
|
contributions: alias('kredits.contributions'),
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ export default EmberObject.extend({
|
|||||||
id: bignumber('idRaw', 'toString'),
|
id: bignumber('idRaw', 'toString'),
|
||||||
account: null,
|
account: null,
|
||||||
balance: kreditsValue('balanceRaw'),
|
balance: kreditsValue('balanceRaw'),
|
||||||
|
totalKreditsEarned: bignumber('totalKreditsEarnedRaw', 'toNumber'),
|
||||||
|
contributionsCount: bignumber('contributionsCountRaw', 'toNumber'),
|
||||||
isCore: false,
|
isCore: false,
|
||||||
ipfsHash: null,
|
ipfsHash: null,
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,14 @@ export default Service.extend({
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
totalKreditsEarned: computed(function() {
|
||||||
|
return this.kredits.Contribution.functions.totalKreditsEarned(true)
|
||||||
|
.then(total => {
|
||||||
|
return total.toNumber();
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
|
||||||
|
|
||||||
loadInitialData() {
|
loadInitialData() {
|
||||||
return this.getContributors()
|
return this.getContributors()
|
||||||
.then(contributors => this.contributors.pushObjects(contributors))
|
.then(contributors => this.contributors.pushObjects(contributors))
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
{{contributor-list contributors=contributorsSorted}}
|
{{contributor-list contributors=contributorsSorted}}
|
||||||
|
|
||||||
<p class="stats">
|
<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.
|
<span class="number">{{contributorsWithKredits.length}}</span> contributors.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ module('Unit | Controller | index', function(hooks) {
|
|||||||
|
|
||||||
let addFixtures = function(controller) {
|
let addFixtures = function(controller) {
|
||||||
[
|
[
|
||||||
{ github_username: "neo", github_uid: "318", balance: 10000 },
|
{ github_username: "neo", github_uid: "318", totalKreditsEarned: 10000 },
|
||||||
{ github_username: "morpheus", github_uid: "843", balance: 15000 },
|
{ github_username: "morpheus", github_uid: "843", totalKreditsEarned: 15000 },
|
||||||
{ github_username: "trinity", github_uid: "123", balance: 5000 },
|
{ github_username: "trinity", github_uid: "123", totalKreditsEarned: 5000 },
|
||||||
{ github_username: "mouse", github_uid: "696", balance: 0 }
|
{ github_username: "mouse", github_uid: "696", totalKreditsEarned: 0 }
|
||||||
].forEach(fixture => {
|
].forEach(fixture => {
|
||||||
controller.get('kredits.contributors').push(Contributor.create(fixture));
|
controller.get('kredits.contributors').push(Contributor.create(fixture));
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user