-
-
Notifications
You must be signed in to change notification settings - Fork 680
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
Sort SimpleFIN transactions in date order #559
base: master
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request modifies the Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/app-simplefin/app-simplefin.js (1)
235-247
: LGTM! Consider extracting the sort comparator.The sorting implementation correctly orders transactions by date in descending order. However, to improve maintainability and reusability, consider extracting the sort comparator into a named function.
+ const compareTransactions = (a, b) => b.sortOrder - a.sortOrder; + - const bookedSorted = booked.sort((a, b) => b.sortOrder - a.sortOrder); - const pendingSorted = pending.sort((a, b) => b.sortOrder - a.sortOrder); - const allSorted = all.sort((a, b) => b.sortOrder - a.sortOrder); + const bookedSorted = booked.sort(compareTransactions); + const pendingSorted = pending.sort(compareTransactions); + const allSorted = all.sort(compareTransactions);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
upcoming-release-notes/559.md
is excluded by!**/*.md
📒 Files selected for processing (1)
src/app-simplefin/app-simplefin.js
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build Docker image (alpine)
- GitHub Check: Build Docker image (ubuntu)
🔇 Additional comments (1)
src/app-simplefin/app-simplefin.js (1)
219-219
: LGTM! Good choice using dateToUse for sorting.The sortOrder property is correctly assigned using the appropriate date field based on the transaction's status (pending vs posted).
Fixes #556
Ensures that the client inserts the starting balance transaction in the right place.
To test, set up the test SimpleFIN credentials on an edge server and sync from blank - the starting balance transaction will be at the top. Try again on this build, it'll be in the correct pace at the bottom