Introduce budget, reimbursements for expenses #195
Reference in New Issue
Block a user
Delete Branch "feature/expenses"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is a big one. It isn't linked from the dashboard yet, but you can browse to
/budgetand propose reimbursements from there.Requires https://github.com/67P/kredits-contracts/pull/198
Refs 67P/kredits-contracts#48
To do
I just finished the functionality of the PR, so there are just the linter errors left. You can test it on your machines now.
There's one known issue, which won't be much of a problem in a production: a race condition, when your tx confirms within the loading of the reimbursement list after pressing the submit button on the reimbursement form. I'm not sure how to handle that, and it doesn't break anything in the unlikely case that you see this in production. Just reload the page and all is good, due to the caching and syncing logic.
I would recommend to always add a block time to your local devchain when testing UI anyway, to not get the wrong feel for how things work in production: e.g.
npm run devchain -- --block-time 5.All done and ready to merge from my point of view.
Wow, that is a lot of changes :)
Left a few comments.
So far I wasn't able to test it manually, because of problems running the contracts (see XMPP).
@@ -0,0 +1,86 @@import Component from '@glimmer/component';Is this intended? If it just returns true, why is it needed?
@@ -0,0 +127,4 @@title: `Expenses covered by ${contributor.name}`,description: this.description,url: this.url,expenses: JSON.parse(JSON.stringify((this.expenses)))What's the reason for this
stringify/parsecombo? Probably a good idea to add a code comment for this.@@ -34,7 +34,6 @@ export default Component.extend({this.set('setupInProgress', true);@@ -0,0 +16,4 @@yield fetch(uri).then(res => res.json()).then(res => this.processBalances(res)).catch(err => {fetchdoesn't reject the promise on normal HTTP errors (i.e. 400 or 500 errors), but only on network failures. So this should probably also check ifres.okistrue.@@ -0,0 +9,4 @@try {const res = await fetch(`${bitstampBaseUrl}/ticker/${currencyPair}/`).then(r => r.json());return res.vwap; // Last 24 hours volume weighted average price} catch(e) {Same as the comment in the
community-fundsservice. This should probably check if the response is ok.@@ -406,23 +447,185 @@ export default Service.extend({});Returning a promise here is redundant, because that's the default for async functions.
@@ -0,0 +127,4 @@title: `Expenses covered by ${contributor.name}`,description: this.description,url: this.url,expenses: JSON.parse(JSON.stringify((this.expenses)))It's to get rid of the EmberObject properties and only retain the pure expense data in the object handed to the wrapper.
@@ -0,0 +9,4 @@try {const res = await fetch(`${bitstampBaseUrl}/ticker/${currencyPair}/`).then(r => r.json());return res.vwap; // Last 24 hours volume weighted average price} catch(e) {If it is not OK, then this already just gracefully fails by not automatically converting numbers.
@@ -0,0 +16,4 @@yield fetch(uri).then(res => res.json()).then(res => this.processBalances(res)).catch(err => {This gracefully fails by catching the exception in
processBalancesI think.@@ -406,23 +447,185 @@ export default Service.extend({});Didn't know that. Not sure I like it being implicit here...
@@ -0,0 +1,86 @@import Component from '@glimmer/component';I guess it's just a leftover from before the proper form validation.
@galfert Did you see my replies? I just merged the corresponding contracts PR, so it'd be great if we can merge this one as well now.
LGTM