-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Reports #20
feat: Reports #20
Conversation
src/Reports/index.ts
Outdated
} | ||
|
||
generateReport(type: ReportProcessorType, filter?: ReportFilter) { | ||
_generateReport(type: 'balanceSheet' | 'cashflow', filter?: ReportFilter) { | ||
return this._root._query( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return this._root._query( | |
return this._query( |
So it also takes the pool id into account when caching the observable
src/Reports/index.ts
Outdated
} | ||
[type, filter?.from, filter?.to, filter?.groupBy], | ||
() => | ||
defer(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't need the defer
here. The callback being called won't immediately fire off requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hinted at by the fact that the callback inside defer
isn't an async function
src/Centrifuge.ts
Outdated
*/ | ||
_queryIPFS<Result>(hash: string): Query<Result> { | ||
return this._query([hash], () => this._getIPFSObservable(hash), { | ||
valueCacheTime: 120, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valueCacheTime can be removed, because ipfs files are immutable
src/Reports/Processor.ts
Outdated
principalPayments: principalRepayments, | ||
...(subtype === 'publicCredit' && { realizedPL: day.sumRealizedProfitFifoByPeriod }), | ||
interestPayments: interest, | ||
assetAcquisitions: aquisistions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any specific reason to go with acquisitions here? Just asking because it is not a term we use anywhere else (either in the protocol code, subquery schema, or the UI).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was looking for a general term that I could use for "Asset purchases" and "Asset financings" so that I wouldn't have to make the distinction between public and private credit. But since the term isn't used anywhere else I guess it makes sense to leave them as separate keys
await firstValueFrom(reports.balanceSheet(filter)) | ||
// TODO: Can't spy on es module | ||
expect(processBalanceSheetSpy.callCount).to.equal(1) | ||
it('should retrieve 6 months worth of data and group by day, month, quarter and year', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super thorough testing, great to see!!
Co-authored-by: Jeroen <[email protected]>
Co-authored-by: Jeroen <[email protected]>
() => { | ||
const dateFilter = { | ||
timestamp: { | ||
greaterThan: filter?.from, | ||
lessThan: filter?.to, | ||
lessThanOrEqualTo: filter?.to && `${filter.to.split('T')[0]}T23:59:59.999Z`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious why lessThan: filter?.to
wasn't sufficient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depending on the exact time of day (seconds) either the day was included or not, this made it more reliable. Maybe worth looking into converting to UTC, that may be causing the problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I messed around with it and I can't find another reliable way to make sure the lessThan day gets included
* activate build-n-test on main branch too * temporarily test the release workflow * remove condition to test * fix naming convention step * fix yarn version syntax * Add readme and fix yarn version for alpha * Fix the yarn gitignore * Add alpha version logic to prepare-release * fix alpha script path * Try to fix ancestor branch issue for yarn * Fix git push and release creation * fix long version of setup-node commit * keep trying to fix the git push * Still figuring out yarn version on CI * Fix typo * trying out different approaches for git push from GHA * chore:Bump version to 0.0.0-alpha.0 * push new version to PR when reviewed * create releases on version bump * update README * add alpha explanaition to README * make sure only one label is applied to the PR * Update naming convention comments * make sure comments are handled even when checks fail * better messaging for PR naming * fix job URL * fix permissions for title checker * fail if naming checks are not working * fix the version bump process * fix naming checks --------- Co-authored-by: GitHub Actions <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #20 +/- ##
======================================
Coverage ? 0.00%
======================================
Files ? 2
Lines ? 3
Branches ? 0
======================================
Hits ? 0
Misses ? 3
Partials ? 0 ☔ View full report in Codecov by Sentry. |
Description
This pull request...
#