More contract-related adjustments
This commit is contained in:
@@ -14,16 +14,11 @@ export default Ember.Controller.extend({
|
||||
|
||||
contractInteractionEnabled: computed.alias('kredits.web3Provided'),
|
||||
|
||||
findContributorByAddress(address) {
|
||||
return this.get('model.contributors')
|
||||
.findBy('address', address);
|
||||
},
|
||||
|
||||
proposalsOpen: function() {
|
||||
let proposals = this.get('model.proposals')
|
||||
.filterBy('executed', false)
|
||||
.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 proposals;
|
||||
@@ -33,7 +28,7 @@ export default Ember.Controller.extend({
|
||||
let proposals = this.get('model.proposals')
|
||||
.filterBy('executed', true)
|
||||
.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 proposals;
|
||||
|
||||
@@ -10,6 +10,7 @@ export default Ember.Object.extend({
|
||||
id: null,
|
||||
creatorAddress: null,
|
||||
recipientAddress: null,
|
||||
recipientId: null,
|
||||
recipientName: null,
|
||||
recipientProfile: null,
|
||||
votesCount: null,
|
||||
|
||||
@@ -27,8 +27,7 @@ export default Ember.Service.extend({
|
||||
return this.get('ipfs').cat(hash, { buffer: true }).then(res => {
|
||||
return res.toString();
|
||||
}, err => {
|
||||
Ember.Logger.error('[ipfs] error trying to fetch file', hash, err);
|
||||
throw err;
|
||||
Ember.Logger.warn('[ipfs] error trying to fetch file', hash, err);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -140,13 +140,12 @@ export default Service.extend({
|
||||
let proposal = Proposal.create({
|
||||
id : i,
|
||||
creatorAddress : p[0],
|
||||
recipientAddress : p[1],
|
||||
recipientId : p[1].toNumber(),
|
||||
votesCount : p[2].toNumber(),
|
||||
votesNeeded : p[3].toNumber(),
|
||||
amount : p[4].toNumber(),
|
||||
executed : p[5],
|
||||
url : p[6],
|
||||
ipfsHash : p[7]
|
||||
ipfsHash : p[6]
|
||||
});
|
||||
|
||||
if (proposal.get('ipfsHash')) {
|
||||
|
||||
Reference in New Issue
Block a user