Skip to content

Conversation

@technologic-technologic
Copy link
Owner

More info below.

- Fixed logic of the query to maths the requirements.

Signed-off-by: Leonardo Trevizo <leonardo.trevizo@encora.com>
- Updated the show-sql as theres no longer need of the  logs
@github-actions
Copy link

PR Summary

  • WHAT Changed:

    • Updated the findCategoriesSummary query in ProductRepository.java to calculate productsInStock using SUM(p.stockQuantity) instead of COUNT(p).
    • Adjusted the calculation for valueInStock to use SUM(p.unitPrice * p.stockQuantity).
  • WHY It Matters:

    • The changes provide a more accurate representation of inventory by summing the stock quantities and calculating the total value based on the actual stock levels, rather than just counting the number of products.
  • RISKS:

    • Potential for incorrect data if existing assumptions about product quantities and pricing are not aligned with the new calculations.
    • Changes in the query may affect any existing functionality that relies on the previous output format.
  • TESTS to Add:

    • Unit tests to verify the correctness of the new calculations in findCategoriesSummary.
    • Integration tests to ensure that the updated repository method interacts correctly with the database and returns expected results.
  • BREAKING CHANGES:

    • The output structure of findCategoriesSummary has changed, which may affect any consumers of this method expecting the previous format.
  • Changed File Paths:

    • src/main/java/com/encorazone/inventory_manager/repository/ProductRepository.java
    • src/main/resources/application.yml (show-sql configuration removed)

@technologic-technologic technologic-technologic added the enhancement New feature or request label Oct 16, 2025
@technologic-technologic technologic-technologic added this to the Major fixes milestone Oct 16, 2025
@technologic-technologic technologic-technologic merged commit 22ccd63 into gen-ai Oct 16, 2025
1 check passed
@technologic-technologic technologic-technologic deleted the 23-enhance-overall-quality branch October 16, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants