Skip to content
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

Merged
merged 44 commits into from
Dec 3, 2024
Merged

feat: Reports #20

merged 44 commits into from
Dec 3, 2024

Conversation

sophialittlejohn
Copy link
Collaborator

Description

This pull request...

#

}

generateReport(type: ReportProcessorType, filter?: ReportFilter) {
_generateReport(type: 'balanceSheet' | 'cashflow', filter?: ReportFilter) {
return this._root._query(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return this._root._query(
return this._query(

So it also takes the pool id into account when caching the observable

}
[type, filter?.from, filter?.to, filter?.groupBy],
() =>
defer(() => {
Copy link
Collaborator

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.

Copy link
Collaborator

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

@sophialittlejohn sophialittlejohn marked this pull request as ready for review November 27, 2024 22:18
*/
_queryIPFS<Result>(hash: string): Query<Result> {
return this._query([hash], () => this._getIPFSObservable(hash), {
valueCacheTime: 120,
Copy link
Collaborator

@onnovisser onnovisser Nov 28, 2024

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

principalPayments: principalRepayments,
...(subtype === 'publicCredit' && { realizedPL: day.sumRealizedProfitFifoByPeriod }),
interestPayments: interest,
assetAcquisitions: aquisistions,
Copy link
Contributor

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).

Copy link
Collaborator Author

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

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
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 () => {
Copy link
Contributor

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!!

@sophialittlejohn sophialittlejohn added alpha Include in alpha release minor labels Dec 2, 2024
@sophialittlejohn sophialittlejohn changed the title Reports feat: Reports Dec 2, 2024
() => {
const dateFilter = {
timestamp: {
greaterThan: filter?.from,
lessThan: filter?.to,
lessThanOrEqualTo: filter?.to && `${filter.to.split('T')[0]}T23:59:59.999Z`,
Copy link
Collaborator

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

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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]>
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@59ff74e). Learn more about missing BASE report.

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.
📢 Have feedback on the report? Share it here.

@gpmayorga gpmayorga merged commit 7a426d4 into main Dec 3, 2024
7 checks passed
@gpmayorga gpmayorga deleted the reports branch December 3, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alpha Include in alpha release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants