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:
2019-04-19 18:16:02 +02:00
parent 83fd9a94b0
commit d1791cadfe
6 changed files with 18 additions and 8 deletions
+1 -1
View File
@@ -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>
+2 -2
View File
@@ -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'),
+2
View File
@@ -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,
+8
View File
@@ -116,6 +116,14 @@ export default Service.extend({
})
}),
totalKreditsEarned: computed(function() {
return this.kredits.Contribution.functions.totalKreditsEarned(true)
.then(total => {
return total.toNumber();
});
}),
loadInitialData() {
return this.getContributors()
.then(contributors => this.contributors.pushObjects(contributors))
+1 -1
View File
@@ -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>