Closed jonathanfallon closed 6 months ago
The updates primarily involve renaming the function startAndEndAtOrThrow
to startsAndEndsAtOrThrow
across several policy files, enhancing the sorting mechanism in getOperatorsAt
, and introducing new functions and tests related to policy validation. The changes ensure consistency in function naming and improve the reliability of date handling and territorial checks within the policy engine.
Files | Summary |
---|---|
.../getOperatorsAt.spec.ts , .../getOperatorsAt.ts |
Enhanced sorting by date and added tests for missing properties. |
.../startsAndEndsAtOrThrow.* , .../startsOrEndsAtOrThrow.* |
Renamed function from startAndEndAtOrThrow to startsAndEndsAtOrThrow and added new tests and functionality for territorial checks. |
.../policies/*.ts , .../policies/*.spec.ts |
Updated multiple policy files with the renamed function and introduced new policy handler PMGFxATMB2024 . |
.../position.ts |
Added new function startsOrEndsAt for checking condition boundaries. |
.../policies/index.ts |
Added new policy PMGFxATMB2024 to the policies map. |
🐰✨🌟
In the land of code where the functions play,
A rabbit hopped through, renaming away.
FromstartAndEnd
tostartsAndEnds
it goes,
Sorting dates and checks, as the policy flows.
Hop, skip, a jump! New tests in the fray,
Making code cleaner by night and by day. 🌙📝
🐰✨🌟
api/src/pdc/services/policy/engine/helpers/startsAndEndsAtOrThrow.ts (1)
`5-5`: Function implementation aligns with the described functionality.api/src/pdc/services/policy/engine/helpers/startsOrEndsAtOrThrow.ts (1)
`5-5`: Function implementation aligns with the described functionality.api/src/pdc/services/policy/engine/helpers/getOperatorsAt.ts (1)
`9-25`: Sorting and date handling logic are correctly implemented and improve the functionality.api/src/pdc/services/policy/engine/helpers/startsOrEndsAtOrThrow.spec.ts (1)
`12-32`: Test cases are comprehensive and correctly implemented.api/src/pdc/services/policy/engine/helpers/position.ts (1)
`26-26`: New helper function correctly implements the required functionality.api/src/pdc/services/policy/engine/policies/PMGFxATMB2024.html.ts (1)
`2-42`: HTML content is well-formatted and accurately describes the campaign rules.api/src/pdc/services/policy/engine/policies/MetropoleSavoie.ts (1)
Line range hint `18-43`: Policy handler updates correctly integrate the renamed function and maintain consistency with the campaign rules.api/src/pdc/services/policy/engine/policies/PetrLunevilloisS12023.ts (1)
Line range hint `20-50`: Policy handler updates correctly integrate the renamed function and maintain consistency with the campaign rules.api/src/pdc/services/policy/engine/policies/index.ts (2)
`17-17`: Import of `PMGFxATMB2024` correctly added. --- `63-63`: Addition of `PMGFxATMB2024` to the policies map is correct and follows the existing pattern.api/src/pdc/services/policy/engine/policies/Nm.ts (1)
`22-22`: Updated import path for `startsAndEndsAtOrThrow` is correct.api/src/pdc/services/policy/engine/policies/ATMB202305.ts (2)
`21-21`: Updated import path for `startsAndEndsAtOrThrow` is correct. --- `76-76`: Conditional usage of `startsAndEndsAtOrThrow` based on `policy_change_date` is implemented correctly.api/src/pdc/services/policy/engine/policies/Occitanie20232024.ts (1)
`20-20`: Updated import path for `startsAndEndsAtOrThrow` is correct.api/src/pdc/services/policy/engine/helpers/getOperatorsAt.spec.ts (3)
`26-29`: New test for handling missing operators property is correctly implemented. --- `31-34`: New test for handling missing date property is correctly implemented. --- `62-100`: Tests for sorting operators in chronological order are correctly implemented and cover various scenarios.api/src/pdc/services/policy/engine/policies/PMGFxATMB2024.ts (1)
`1-149`: The implementation of the `PMGFxATMB2024` policy handler is correct. It includes proper imports, class definition, and methods for processing exclusions and stateless operations. The incentive calculation logic matches the campaign's rules.api/src/pdc/services/policy/engine/policies/GrandPoitiers.spec.ts (1)
Line range hint `51-61`: New test for handling exclusions in the `GrandPoitiers` policy handler is correctly implemented.api/src/pdc/services/policy/engine/policies/PMGFxATMB2024.spec.ts (3)
`48-98`: New test for handling exclusions in the `PMGFxATMB2024` policy handler is correctly implemented. --- `100-172`: Tests for trips inside and outside the AOM in the `PMGFxATMB2024` policy handler are correctly implemented and cover various scenarios. --- `174-202`: Test for handling driver month limits in the `PMGFxATMB2024` policy handler is correctly implemented.
Summary by CodeRabbit
New Features
Enhancements
Bug Fixes
Tests
Documentation
Refactor