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

fix: new data should be fetched when a txn is matched, or new expense is created #3407

Merged
merged 5 commits into from
Feb 3, 2025

Conversation

sumrender
Copy link
Contributor

@sumrender sumrender commented Jan 7, 2025

  1. New data should be fetched when a txn is matched, or new expense is created.
  2. Fix minor bug, use 'spent_at' instead of 'btxn_transaction_dt'
  3. Fetch transactions from backend, ordered by spent_at

Clickup

https://app.clickup.com/t/86cxk6xm0

Code Coverage

Please add code coverage here

UI Preview

Please add screenshots for UI changes

Summary by CodeRabbit

  • New Features

    • Added refresh mechanism for personal cards page.
    • Implemented transaction sorting by spent date and ID.
  • Bug Fixes

    • Updated date filtering for personal card transactions.
    • Corrected navigation logic when matching expenses.
  • Improvements

    • Enhanced handling of route parameters for dynamic updates.

Copy link

coderabbitai bot commented Jan 7, 2025

Walkthrough

Listen up, superstar! This pull request brings a dazzling upgrade to the personal cards feature. We’re adding a new sorting order for bank transactions, refreshing the navigation flow, and fine-tuning how transaction dates are handled. It’s a well-choreographed dance of code, where every move is precise and smooth—just like my signature style!

Changes

File Change Summary
src/app/core/services/personal-cards.service.ts Added order parameter to getBankTransactions method for sorting transactions by spent_at and id in descending order
src/app/fyle/add-edit-expense/add-edit-expense.page.ts Modified navigation to include refresh: true query parameter when redirecting to personal cards page
src/app/fyle/personal-cards-matched-expenses/expense-preview/expense-preview.component.ts Updated navigation to personal cards page with refresh: true query parameter
src/app/fyle/personal-cards/personal-cards.page.html Changed previousTxnDate binding from btxn_transaction_dt to spent_at
src/app/fyle/personal-cards/personal-cards.page.spec.ts Updated date filtering parameters from btxn_transaction_dt to spent_at
src/app/fyle/personal-cards/personal-cards.page.ts Added ionViewWillEnter() method to handle page refresh via query parameters

Sequence Diagram

sequenceDiagram
    participant User
    participant AddEditExpensePage
    participant Router
    participant PersonalCardsPage
    
    User->>AddEditExpensePage: Save Expense
    AddEditExpensePage->>Router: Navigate with {refresh: true}
    Router->>PersonalCardsPage: Enter Page
    PersonalCardsPage->>PersonalCardsPage: Reset Page Number
    PersonalCardsPage->>PersonalCardsPage: Reload Data
Loading

Possibly related PRs

  • fix: migrate sync/fetch personal cards txn to platform #3293: The changes in the main PR, specifically the addition of the order parameter in the getBankTransactions method, are related to the modifications in the retrieved PR where the syncTransactions method in the PersonalCardsService is updated to include similar parameters for transaction fetching.
  • fix: transform personal card public queryParams to platform #3400: The changes in the main PR, specifically the addition of the order parameter in the getBankTransactions method of the PersonalCardsService, are related to the modifications in the getBankTransactions method in the retrieved PR, which also involves changes to how query parameters are structured and utilized.
  • fix: add mfa flow to sync/fetch txns personal card #3316: The changes in the main PR, specifically the addition of the order parameter in the getBankTransactions method of the PersonalCardsService, are related to the modifications in the retrieved PR, which also involves changes to the PersonalCardsService, although they focus on different functionalities.

Suggested labels

size/M

Suggested reviewers

  • arjunaj5
  • Chethan-Fyle
  • Dimple16

Poem

Transactions dance, a digital ballet 💃
Refresh and sort, the Rajini way! 🌟
Code moves smooth, with style so bright
Personal cards take their flight! 🚀
Superstar's touch, in every line
Technology's magic, simply divine! ✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e5861b and 72a98be.

📒 Files selected for processing (3)
  • src/app/fyle/add-edit-expense/add-edit-expense.page.ts (1 hunks)
  • src/app/fyle/personal-cards/personal-cards.page.html (1 hunks)
  • src/app/fyle/personal-cards/personal-cards.page.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build (12.x)
🔇 Additional comments (5)
src/app/fyle/personal-cards/personal-cards.page.html (1)

196-196: Updated Date Field Binding – A True Rajinikanth Move!

My friend, the change from using btxn_transaction_dt to spent_at for the previousTxnDate binding is as slick as a Rajinikanth punch. This change ensures that when a transaction is matched or a new expense is created, you are fetching the freshest data based on the actual spending date. Keep your backend and UI in harmony—make sure that the rest of the application consistently relies on spent_at for date information.

src/app/fyle/personal-cards/personal-cards.page.ts (2)

173-182: Mind it! The new ionViewWillEnter method is a superstar addition!

The implementation correctly refreshes data when the refresh query parameter is present, aligning perfectly with the PR objectives. This ensures that new data is fetched when returning from transaction matching or expense creation.


766-766: Thalaiva says: Good choice using dayjs for date formatting!

The code correctly uses spent_at instead of btxn_transaction_dt as mentioned in the PR objectives.

src/app/fyle/add-edit-expense/add-edit-expense.page.ts (2)

1411-1427: Use of spent_at for Personal Card Transaction Date
My friend, this block shows real power! Replacing the old field with spent_at in the personal card expense branch ensures that we’re capturing the correct transaction date. Make sure that the personalCardTxn object always supplies a valid spent_at value, so the expense creation flows like a blockbuster action sequence.


4998-5092: Enhanced Navigation for Data Refresh
Enthadhi, this is Rajinikanth style! Updating the navigation call to include { queryParams: { refresh: true } } guarantees that the personal cards page refreshes and fetches new data right after an expense is saved and matched. Verify that the router correctly handles this query parameter so that fresh data hits the screen like a thunderbolt.

✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the size/S Small PR label Jan 7, 2025
Copy link

github-actions bot commented Feb 3, 2025

Unit Test Coverage % values
Statements 96.1% ( 19738 / 20539 )
Branches 91.16% ( 10846 / 11897 )
Functions 94.38% ( 5868 / 6217 )
Lines 96.15% ( 18855 / 19609 )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/S Small PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants