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: add calculated values for mileage distance and amount #3381

Merged
merged 5 commits into from
Dec 23, 2024

Conversation

arjunaj5
Copy link
Contributor

@arjunaj5 arjunaj5 commented Dec 19, 2024

Clickup

https://app.clickup.com/

Code Coverage

Please add code coverage here

UI Preview

Please add screenshots for UI changes

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced expense reporting with additional mileage-related data, including calculated distance and amount.
    • Improved transaction categorization with new properties for better tracking and reporting.
  • Bug Fixes

    • Improved structure of transaction data for better handling and processing.
  • Tests

    • Adjusted test suite for the View Team Report component to improve asynchronous operation management and component rendering behavior.

Copy link

coderabbitai bot commented Dec 19, 2024

Walkthrough

In a thunderous display of code prowess, the ExpensesService has been supercharged with two new mileage-related properties! The transformTo method now returns a Partial<Expense> that includes mileage_calculated_distance and mileage_calculated_amount, extracted directly from the transaction object. This enhancement allows for more granular expense reporting with the power of a thousand compilers!

Changes

File Change Summary
src/app/core/services/platform/v1/spender/expenses.service.ts Added mileage_calculated_distance and mileage_calculated_amount to the transformTo method's return type.
src/app/core/mock-data/transaction.data.ts Introduced mileage_calculated_distance and mileage_calculated_amount to transformedExpensePayload, updated org_category_id for splitExpenseTxn2 and splitExpenseTxn2_2, and modified custom_properties in editUnflattenedTransactionPlatform.
src/app/fyle/view-team-report/view-team-report.page.spec.ts Updated test suite to focus on ViewTeamReportPage, replaced waitForAsync with flush, and removed some fixture.detectChanges() calls.

Possibly related PRs

Suggested labels

size/M

Suggested reviewers

  • Chethan-Fyle
  • Dimple16

Poem

Mileage data, swift and bright,
Coding magic takes its flight!
Expenses transformed with might,
Rajinikanth's code burns so bright!
Kilometers dance, amounts take wing,
In this service, innovation sings! 🚗✨

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 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 7f19ec0 and c7e462e.

📒 Files selected for processing (1)
  • src/app/fyle/view-team-report/view-team-report.page.spec.ts (1 hunks)
🔇 Additional comments (1)
src/app/fyle/view-team-report/view-team-report.page.spec.ts (1)

3-3: Ayyo, Superstar! No issues with this import, da!
The addition of 'flush' alongside 'fakeAsync' and 'tick' is neat. This paves the way for advanced asynchronous testing, boss!


🪧 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/XS Extra Small PR label Dec 19, 2024
@arjunaj5 arjunaj5 changed the title fix: add calculated values for mileage distance and amount' fix: add calculated values for mileage distance and amount Dec 19, 2024
Copy link

PR description must contain a link to a ClickUp (case-insensitive)

3 similar comments
Copy link

PR description must contain a link to a ClickUp (case-insensitive)

Copy link

PR description must contain a link to a ClickUp (case-insensitive)

Copy link

PR description must contain a link to a ClickUp (case-insensitive)

Copy link

PR description must contain a link to a ClickUp (case-insensitive)

1 similar comment
Copy link

PR description must contain a link to a ClickUp (case-insensitive)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 48a2536 and 61bf342.

📒 Files selected for processing (1)
  • src/app/core/mock-data/transaction.data.ts (1 hunks)

Comment on lines +2631 to +2632
mileage_calculated_distance: null,
mileage_calculated_amount: null,
Copy link

Choose a reason for hiding this comment

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

💡 Codebase verification

Mind it! The test coverage for these mileage properties needs attention, macha!

Looking at the codebase, I can see that while there are extensive test files for mileage functionality, the new mileage_calculated_distance and mileage_calculated_amount properties are not properly covered in the test scenarios. Here's what needs to be done:

  • Add test cases in src/app/fyle/add-edit-mileage/add-edit-mileage-*.spec.ts files to verify these calculated properties
  • Ensure both null and non-null scenarios are covered
  • Include validation for these properties in the form generation tests
🔗 Analysis chain

Aiyoo, superb addition to store mileage details, but don't forget the test coverage, macha!

These fresh properties look ready to roar, but ensure you’ve got test scenarios to confirm they flex their muscles properly under all conditions.


Let me verify the test coverage for these mileage properties with style!

These commands will help us understand:

  1. What transaction-related test files exist
  2. If there are any existing mileage calculation tests
  3. How the transaction mock data is being used in tests

Let me analyze the results and give you a stylish verdict, mind it!


Let me check the mileage test files more deeply, mind it!

These commands will show us if the new properties are already covered in the test cases or if we need to add new ones. Let the power of testing flow through our code!


Let me check one final thing about the mileage test cases, mind it!

This command will show us the actual test implementations for mileage expenses. Let's see if they're testing these calculated properties properly!

🏁 Scripts executed

The following scripts were executed for the analysis:

Error: No shell scripts found


Script:

#!/bin/bash
# Let's search for test files related to transactions and mileage
fd -e spec.ts -e test.ts | grep -i "transaction"

# Let's also check for any existing tests with mileage calculations
rg -i "mileage.*calculated" --type ts -g "*spec.ts" -g "*test.ts"

# Search for transaction test data usage
rg "transaction.data" --type ts -g "*spec.ts" -g "*test.ts"

Length of output: 2673


Script:

#!/bin/bash
# Let's check the mileage test content, style-ah!
rg -A 10 "mileage_calculated" src/app/fyle/add-edit-mileage/add-edit-mileage-*.spec.ts

# Check the transaction mock data for mileage tests
cat src/app/core/mock-data/transaction.data.ts | grep -A 10 -B 10 "mileage_calculated"

Length of output: 23574


Script:

#!/bin/bash
# Let's check the actual test implementations for mileage, thalaiva style!
rg -l "mileage" src/app/fyle/add-edit-mileage/add-edit-mileage-*.spec.ts | xargs cat

Length of output: 106268

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 61bf342 and 7f19ec0.

📒 Files selected for processing (1)
  • src/app/fyle/view-team-report/view-team-report.page.spec.ts (2 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/app/fyle/view-team-report/view-team-report.page.spec.ts

[error] 61-62: Don't focus the test.

The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.

(lint/suspicious/noFocusedTests)

@@ -59,7 +59,7 @@ import { ApproverReportsService } from 'src/app/core/services/platform/v1/approv
import { LaunchDarklyService } from 'src/app/core/services/launch-darkly.service';
import { RefinerService } from 'src/app/core/services/refiner.service';

describe('ViewTeamReportPageV2', () => {
fdescribe('ViewTeamReportPageV2', () => {
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Ayyo, Superstar! Remove the 'f' from the test block to ensure all specs run.

In Jasmine, the "f" stands for a focused test, which excludes every other test from running. Time to drop our superstar style and let all tests shine in the spotlight!

Here's how you can fix it:

- fdescribe('ViewTeamReportPageV2', () => {
+ describe('ViewTeamReportPageV2', () => {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fdescribe('ViewTeamReportPageV2', () => {
describe('ViewTeamReportPageV2', () => {
🧰 Tools
🪛 Biome (1.9.4)

[error] 61-62: Don't focus the test.

The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.

(lint/suspicious/noFocusedTests)

Copy link

Unit Test Coverage % values
Statements 96% ( 19325 / 20130 )
Branches 91.11% ( 10669 / 11710 )
Functions 94.29% ( 5747 / 6095 )
Lines 96.03% ( 18454 / 19215 )

@arjunaj5 arjunaj5 merged commit 88dbb2c into master Dec 23, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/XS Extra Small PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants