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

Add income and spending insight cards to dashboard #668

Merged

Conversation

JoshAntBrown
Copy link
Contributor

This PR implements the income and spending insight cards for the dashboard.

Screenshot 2024-04-23 at 14 50 25

Requirements

  • Should generate a time series of income and spending for a Family, scoped to Period.last_30_days
    • Each data point in the series represents a "Trailing 30 day sum" of income (negative transaction values)
    • The "headline" number shows the last value in the series
    • The "trend" value is the overall time series trend
  • Should find the top 3 accounts with the most income or spending within the last 30 days and display the sum
    • Each account is an anchor that goes to that account page
    • Bank icons are not in-scope (just use a generic letter as shown in designs)
    • A "more" counter should show if there are more than 3 accounts
  • Display a trendline of series. No tooltips, no axes.
  • These insights should be included in the dashboard

/claim #645
Resolves #645

@JoshAntBrown
Copy link
Contributor Author

/claim #645

Copy link
Collaborator

@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

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

The structure of this looks good to me, just added some notes regarding tests / exchange rate conversions for handling multi-currency.

app/models/family.rb Outdated Show resolved Hide resolved
app/models/family.rb Show resolved Hide resolved
@JoshAntBrown JoshAntBrown force-pushed the feature/transaction-insight-cards branch from b622d36 to d3b4d55 Compare April 23, 2024 19:52
@JoshAntBrown
Copy link
Contributor Author

JoshAntBrown commented Apr 23, 2024

I've had a bit of a refactor and added a test in a similar fashion to the other account snapshot.

Hopefully this is a bit more manageable now without straying too far from Active Record conventions.

Here's my copy of the test cases, updated to include spending and income on a rolling basis:
https://docs.google.com/spreadsheets/d/112tRiy0l8WWngEGMdEX2JprYJmYWUW--B2UDUiW9nOE/edit

Here's how it looks with the demo data:
Screenshot 2024-04-23 at 21 55 47

Copy link
Collaborator

@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for adding those test cases! I have copy/pasted the expected results into that main spreadsheet for now and we'll eventually get all those into an easier format to collaborate on.

@zachgoll zachgoll merged commit 461fa67 into maybe-finance:main Apr 24, 2024
4 checks passed
@Samuelodan
Copy link

Ah, that's an interesting solution. I was starting to get a hang of the models, the associations between them, and the TimeSeries, but even if I got a few more days, I doubt I would've completed the feature.

I guess I'll hang around in this repo and slowly learn how the whole thing is put together.

You all are doing amazing work.
Thanks for the opportunity to contribute. ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Implement income and spending insight cards for dashboard
3 participants