Refactor contributor data methods some more
This commit is contained in:
+7
-11
@@ -54,11 +54,7 @@ export default Ember.Service.extend({
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getContributors() {
|
getContributorData(i) {
|
||||||
return this.getValueFromContract('contributorsCount').then(contributorsCount => {
|
|
||||||
let contributors = [];
|
|
||||||
|
|
||||||
let gatherContributorData = (i) => {
|
|
||||||
let promise = new Ember.RSVP.Promise((resolve, reject) => {
|
let promise = new Ember.RSVP.Promise((resolve, reject) => {
|
||||||
this.getValueFromContract('contributorAddresses', i).then(address => {
|
this.getValueFromContract('contributorAddresses', i).then(address => {
|
||||||
this.getValueFromContract('contributors', address).then(person => {
|
this.getValueFromContract('contributors', address).then(person => {
|
||||||
@@ -77,20 +73,20 @@ export default Ember.Service.extend({
|
|||||||
}).catch(err => reject(err));
|
}).catch(err => reject(err));
|
||||||
});
|
});
|
||||||
return promise;
|
return promise;
|
||||||
};
|
},
|
||||||
|
|
||||||
|
getContributors() {
|
||||||
|
return this.getValueFromContract('contributorsCount').then(contributorsCount => {
|
||||||
|
let contributors = [];
|
||||||
|
|
||||||
for(var i = 0; i < contributorsCount.toNumber(); i++) {
|
for(var i = 0; i < contributorsCount.toNumber(); i++) {
|
||||||
contributors.push(gatherContributorData(i));
|
contributors.push(this.getContributorData(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return Ember.RSVP.all(contributors);
|
return Ember.RSVP.all(contributors);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
balanceOf: function(address) {
|
|
||||||
return this.get('kreditsContract').balanceOf(address).toNumber();
|
|
||||||
}.property('kreditsContract'),
|
|
||||||
|
|
||||||
logKreditsContract: function() {
|
logKreditsContract: function() {
|
||||||
Ember.Logger.debug('[kredits] kreditsContract', this.get('kreditsContract'));
|
Ember.Logger.debug('[kredits] kreditsContract', this.get('kreditsContract'));
|
||||||
}.on('init')
|
}.on('init')
|
||||||
|
|||||||
Reference in New Issue
Block a user