More contract-related adjustments
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user