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

HP-1861: Leasing add #61

Merged
merged 14 commits into from Mar 29, 2024
Merged

HP-1861: Leasing add #61

merged 14 commits into from Mar 29, 2024

Conversation

bladeroot
Copy link
Member

@bladeroot bladeroot commented Mar 14, 2024

Summary by CodeRabbit

  • New Features
    • Introduced a LeasingWasStarted event to signify the start of a leasing period.
    • Added functionality to handle the beginning and ending of leasing charges.
  • Enhancements
    • Improved leasing functionality with more descriptive method names and additional checks for the first month of leasing.
  • Tests
    • Updated the Leasing feature tests to include scenarios with the LeasingWasStarted event.

Copy link
Contributor

coderabbitai bot commented Mar 14, 2024

Warning

Rate Limit Exceeded

@bladeroot has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 9 minutes and 31 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between f2372a3 and 40a7b2c.

Walkthrough

The recent updates bring about significant improvements to the codebase, focusing on enhancing type safety and refining leasing functionalities. These changes encompass the adoption of strict typing, the introduction of a new event signaling the initiation of a leasing period, and method refinements to streamline tracking leasing timelines. Furthermore, enhancements in sales-related classes empower better data management capabilities, while testing scenarios now encompass the newly introduced leasing event.

Changes

File Path Change Summary
src/charge/modifiers/Leasing.php Added declare(strict_types=1), introduced new event and methods; Renamed methods for clarity.
src/charge/modifiers/event/LeasingWasStarted.php Introduced LeasingWasStarted class for event handling.
src/sale/Sale.php, src/sale/SaleCreationDto.php Added $data property for improved data management.
tests/behat/Leasing.feature Updated to include "LeasingWasStarted" event in test scenarios.
src/sale/SaleInterface.php Added getData() method to SaleInterface for data retrieval.

Poem

🌟 A Whimsical Code Update Tale 🌟
In a land of code, where rabbits dwell,
Strict types and leasing tales they tell.
New events sparkle, under the moon,
As the LeasingWasStarted sings a tune.
🐰 With each line, and every charge,
Our code grows stronger, our scope more large.
So here's to changes, both big and small,
May our code leap high and never fall.

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>.
    • Generate unit-tests 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 tests 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 4afab39 and 0a54bba.
Files selected for processing (5)
  • src/charge/modifiers/Leasing.php (6 hunks)
  • src/charge/modifiers/event/LeasingWasStarted.php (1 hunks)
  • src/sale/Sale.php (2 hunks)
  • src/sale/SaleCreationDto.php (1 hunks)
  • tests/behat/Leasing.feature (2 hunks)
Additional comments: 9
src/sale/SaleCreationDto.php (1)
  • 30-30: The addition of the $data property to SaleCreationDto is a good enhancement for flexibility. However, consider adding a doc comment above the $data property to clarify its intended use and expected data type. This can help other developers understand its purpose and ensure consistent usage.
src/charge/modifiers/event/LeasingWasStarted.php (1)
  • 18-64: The implementation of the LeasingWasStarted event class is well-done. It properly tracks the initiation of leasing and includes necessary details for serialization. Good use of DateTimeImmutable for immutability and clear structure in the jsonSerialize method.
tests/behat/Leasing.feature (2)
  • 18-18: The update to include the "LeasingWasStarted" event in the scenario examples is a crucial addition for testing the new functionality. Well-defined scenarios ensure thorough verification.
  • 32-32: Including the "LeasingWasStarted" event in this scenario as well ensures comprehensive testing across different conditions. Good job on covering various test cases.
src/sale/Sale.php (1)
  • 55-55: The addition of the $data property to the Sale class enhances its functionality. Consider adding a doc comment above the $data property and its getter method to clarify the intended use and expected data type.
src/charge/modifiers/Leasing.php (4)
  • 3-3: The addition of declare(strict_types=1); is a good practice for ensuring type safety in PHP. This aligns with modern PHP development standards.
  • 21-21: The introduction of the LeasingWasStarted event is a significant enhancement for tracking leasing operations. This change aligns with the PR's objectives to improve leasing functionality.
  • 98-110: The method isFirstMonthInLeasingPassed is well-implemented. Consider adding a doc comment to explain its purpose and the logic behind the implementation for better readability and maintenance.
  • 153-158: The addition of the createLeasingStartingCharge method is a key enhancement. It's important to document new methods with comments to explain their purpose, parameters, and expected outcomes.

Copy link
Member

@SilverFire SilverFire left a comment

Choose a reason for hiding this comment

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

How the PR name "Leasing add" relates to what's happening inside?

@@ -125,6 +129,11 @@ public function setId($id)
$this->id = $id;
}

public function getData()
Copy link
Member

Choose a reason for hiding this comment

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

Return data type

Copy link
Member Author

Choose a reason for hiding this comment

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

in SaleInterface

Copy link
Member

@SilverFire SilverFire left a comment

Choose a reason for hiding this comment

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

I don't see how you use these changes in the application code. Could you explain you why need it?

Copy link
Contributor

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0a54bba and bbe6b94.
Files selected for processing (1)
  • src/sale/SaleInterface.php (1 hunks)

src/sale/SaleInterface.php Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between bbe6b94 and f2372a3.
Files selected for processing (1)
  • src/sale/SaleInterface.php (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/sale/SaleInterface.php

@SilverFire SilverFire merged commit cd6b779 into hiqdev:master Mar 29, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants