More contract-related adjustments

This commit is contained in:
2017-08-14 15:31:58 +02:00
parent bc19363bf9
commit 576e2741a9
4 changed files with 6 additions and 12 deletions
+2 -7
View File
@@ -14,16 +14,11 @@ export default Ember.Controller.extend({
contractInteractionEnabled: computed.alias('kredits.web3Provided'), contractInteractionEnabled: computed.alias('kredits.web3Provided'),
findContributorByAddress(address) {
return this.get('model.contributors')
.findBy('address', address);
},
proposalsOpen: function() { proposalsOpen: function() {
let proposals = this.get('model.proposals') let proposals = this.get('model.proposals')
.filterBy('executed', false) .filterBy('executed', false)
.map(p => { .map(p => {
p.set('recipientName', this.findContributorByAddress(p.get('recipientAddress')).name); p.set('recipientName', this.get('model.contributors').findBy('id', p.get('recipientId')).name);
return p; return p;
}); });
return proposals; return proposals;
@@ -33,7 +28,7 @@ export default Ember.Controller.extend({
let proposals = this.get('model.proposals') let proposals = this.get('model.proposals')
.filterBy('executed', true) .filterBy('executed', true)
.map(p => { .map(p => {
p.set('recipientName', this.findContributorByAddress(p.get('recipientAddress')).name); p.set('recipientName', this.get('model.contributors').findBy('id', p.get('recipientId')).name);
return p; return p;
}); });
return proposals; return proposals;
+1
View File
@@ -10,6 +10,7 @@ export default Ember.Object.extend({
id: null, id: null,
creatorAddress: null, creatorAddress: null,
recipientAddress: null, recipientAddress: null,
recipientId: null,
recipientName: null, recipientName: null,
recipientProfile: null, recipientProfile: null,
votesCount: null, votesCount: null,
+1 -2
View File
@@ -27,8 +27,7 @@ export default Ember.Service.extend({
return this.get('ipfs').cat(hash, { buffer: true }).then(res => { return this.get('ipfs').cat(hash, { buffer: true }).then(res => {
return res.toString(); return res.toString();
}, err => { }, err => {
Ember.Logger.error('[ipfs] error trying to fetch file', hash, err); Ember.Logger.warn('[ipfs] error trying to fetch file', hash, err);
throw err;
}); });
} }
+2 -3
View File
@@ -140,13 +140,12 @@ export default Service.extend({
let proposal = Proposal.create({ let proposal = Proposal.create({
id : i, id : i,
creatorAddress : p[0], creatorAddress : p[0],
recipientAddress : p[1], recipientId : p[1].toNumber(),
votesCount : p[2].toNumber(), votesCount : p[2].toNumber(),
votesNeeded : p[3].toNumber(), votesNeeded : p[3].toNumber(),
amount : p[4].toNumber(), amount : p[4].toNumber(),
executed : p[5], executed : p[5],
url : p[6], ipfsHash : p[6]
ipfsHash : p[7]
}); });
if (proposal.get('ipfsHash')) { if (proposal.get('ipfsHash')) {