Display contribution balances not token balances #107
@@ -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,12 @@ 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 => 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>
|
||||||
|
|||||||
Generated
+6
-24
@@ -10911,33 +10911,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"kredits-contracts": {
|
"kredits-contracts": {
|
||||||
"version": "5.1.1",
|
"version": "5.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/kredits-contracts/-/kredits-contracts-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/kredits-contracts/-/kredits-contracts-5.2.0.tgz",
|
||||||
"integrity": "sha512-hEM/ZOcoYejOix8LMG/mMVQVoD/9q18yjQTXeQwuX2x/APP95CH8HK/UsPIqxXtMP1L3XklWnMuqTVbYUc5UYg==",
|
"integrity": "sha512-XS8PN01SEiSNDKUhH28KVmGJ7hS3HlhT+CsaAMgqvU9ACcE1Wizqd0AxoRutUmJkILic6W6bQQ5gRqSHcBpPBA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"ethers": "^4.0.27",
|
"ethers": "^4.0.27",
|
||||||
"ipfs-http-client": "^30.1.1",
|
"ipfs-http-client": "^30.1.1",
|
||||||
"kosmos-schemas": "^2.0.0",
|
"kosmos-schemas": "^2.0.0",
|
||||||
"rsvp": "^4.8.2",
|
|
||||||
"tv4": "^1.3.0"
|
"tv4": "^1.3.0"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"kosmos-schemas": {
|
|
||||||
"version": "2.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/kosmos-schemas/-/kosmos-schemas-2.0.0.tgz",
|
|
||||||
"integrity": "sha512-zIjWcDxaN94m1vPgUaI5LRX6y07Ihw9ScPoGKf1NkZ0sLgD/CRV8YIKRyDafH5mThe3uBN2+F6H6Gp5qhNhALg==",
|
|
||||||
"dev": true,
|
|
||||||
"requires": {
|
|
||||||
"brfs-babel": "^1.0.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rsvp": {
|
|
||||||
"version": "4.8.4",
|
|
||||||
"resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.4.tgz",
|
|
||||||
"integrity": "sha512-6FomvYPfs+Jy9TfXmBpBuMWNH94SgCsZmJKcanySzgNNP6LjWxBvyLTa9KaMfDDM5oxRfrKDB0r/qeRsLwnBfA==",
|
|
||||||
"dev": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"labeled-stream-splicer": {
|
"labeled-stream-splicer": {
|
||||||
@@ -12148,9 +12130,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"multicodec": {
|
"multicodec": {
|
||||||
"version": "0.5.0",
|
"version": "0.5.1",
|
||||||
"resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/multicodec/-/multicodec-0.5.1.tgz",
|
||||||
"integrity": "sha512-lKsJeT4cKeSq0rVEWhO3oSBgDN4sMY1sNZKlvl68g/ZAahjPS1KIVyF4IqhuYmCdtOyKs4Q4hQ6M0C3iqRnuqQ==",
|
"integrity": "sha512-Q5glyZLdXVbbBxvRYHLQHpu8ydVf1422Z+v9fU47v2JCkiue7n+JcFS7uRv0cQW8hbVtgdtIDgYWPWaIKEXuXA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"varint": "^5.0.0"
|
"varint": "^5.0.0"
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@
|
|||||||
"eslint-plugin-ember": "^5.2.0",
|
"eslint-plugin-ember": "^5.2.0",
|
||||||
"ethers": "^4.0.27",
|
"ethers": "^4.0.27",
|
||||||
"kosmos-schemas": "^2.0.0",
|
"kosmos-schemas": "^2.0.0",
|
||||||
"kredits-contracts": "^5.1.1",
|
"kredits-contracts": "^5.2.0",
|
||||||
"loader.js": "^4.7.0",
|
"loader.js": "^4.7.0",
|
||||||
"qunit-dom": "^0.8.0",
|
"qunit-dom": "^0.8.0",
|
||||||
"tv4": "^1.3.0"
|
"tv4": "^1.3.0"
|
||||||
|
|||||||
@@ -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
Can be written more concise: