WIP reimbursement sync

This commit is contained in:
2020-10-09 15:40:46 +02:00
parent a41d1b1dbd
commit 93e2a23ac7
2 changed files with 20 additions and 12 deletions
+6 -3
View File
@@ -214,6 +214,10 @@ export default Service.extend({
.filter(r => r.confirmedAt <= this.currentBlock);
}),
reimbursementsPending: computed('reimbursements.[]', 'pendingTx', function() {
return this.reimbursements.filter(r => !r.id);
}),
async loadInitialData () {
const numCachedContributors = await this.browserCache.contributors.length();
if (numCachedContributors > 0) {
@@ -676,9 +680,8 @@ export default Service.extend({
async handleReimbursementAdded (id, addedByAccount, amount) {
console.debug('[kredits] ReimbursementAdded event received', { id, addedByAccount, amount });
const pendingReimbursement = this.reimbursements.find(r => {
return (r.id === null) &&
(this.currentUserAccounts.includes(addedByAccount)) &&
const pendingReimbursement = this.reimbursementsPending.find(r => {
return (this.currentUserAccounts.includes(addedByAccount)) &&
(r.amount.toString() === amount.toString());
});