Closed jonathanfallon closed 4 months ago
The recent changes focus on enhancing carpooling policies in the Lannion-Trégor region for 2024. These updates include refining policy handlers, adding tests for policy functionalities, and adjusting UI components for better user experience.
File Path | Change Summary |
---|---|
.../policies/LannionTregor2024.html.ts , .../LannionTregor2024.ts |
Introduced a new policy handler with detailed rules for the Lannion-Trégor 2024 carpooling campaign. |
.../policies/LannionTregor2024.spec.ts |
Added test cases to validate the behavior of the new policy handler in various carpooling scenarios. |
.../campaign-ui/.../campaign-main-metrics.component.ts |
Updated the end date calculation logic to display the correct campaign duration to users. |
🐰✨ In Lannion-Trégor, policies take flight, Tests ensure they're shining bright. UI tweaks for a better view, Carpooling rules, fresh and new. Let's celebrate this coding brew! 🚗🌟
api/src/pdc/services/policy/engine/helpers/per.ts (2)
`19-20`: LGTM! The logic for handling distance calculations with offset and limit is correctly implemented. --- `20-20`: LGTM! The `perSeat` function correctly calculates the amount based on the number of seats, defaulting to 1 if not specified.api/src/pdc/services/policy/engine/helpers/onDistanceRange.ts (2)
`14-16`: LGTM! The function correctly handles cases where the carpool distance is missing by throwing an `InvalidParamsException`. --- `25-25`: LGTM! The function `onDistanceRangeOrThrow` correctly uses the `onDistanceRange` function to validate the distance and throws an exception if it's out of range.api/src/pdc/services/policy/engine/helpers/onDistanceRange.spec.ts (10)
`13-13`: LGTM! The test case correctly checks that the function returns false when the distance is under the specified range. --- `17-17`: LGTM! The test case correctly checks that the function returns false when the distance is above the specified range. --- `21-22`: LGTM! The test case correctly checks that the function returns true when the distance is within the specified range. --- `25-26`: LGTM! The test case correctly checks that the function returns true when the distance is exactly on the minimum specified range. --- `29-30`: LGTM! The test case correctly checks that the function returns false when the distance is exactly on the maximum specified range. --- `33-34`: LGTM! The test case correctly checks that the function returns true when no parameters are provided. --- `37-38`: LGTM! The test case correctly checks that the function returns true when the minimum parameter is missing and the distance is within the specified maximum range. --- `41-42`: LGTM! The test case correctly checks that the function returns false when the minimum parameter is missing and the distance is not within the specified maximum range. --- `45-46`: LGTM! The test case correctly checks that the function returns true when the maximum parameter is missing and the distance is within the specified minimum range. --- `49-49`: LGTM! The test case correctly checks that the function returns false when the maximum parameter is missing and the distance is not within the specified minimum range.
policy_id :
1056
Summary by CodeRabbit
New Features
Bug Fixes