avia
avia copied to clipboard
Promotion re-evaluation for line_item CRUD
Why?
If an order has promotion applied to it, then if any of the line items are touched(updated, removed) or a new line item is added, promotion associated with it needs to be re-evaluated so that right adjustments are present for the order.
This change addresses the need by:
This change
- Adds a module to handle promotion re-evaluation whenever line items of an order are added, removed or updated.
- The ineligible adjustments for an order are now removed so that only eligible adjustments are present. [delivers #163001984]
Checklist
- [ ] I have read CONTRIBUTING.md.
- [ ] My code follows the style guidelines of this project.
- [ ] I have commented my code, particularly in hard-to-understand areas.
- [ ] My code does not generate any (new)
credo
and compile-time warnings. - [ ] I have updated the documentation wherever necessary.
- [ ] I have added tests to cover my changes.
Codecov Report
Merging #478 into develop will increase coverage by
0.54%
. The diff coverage is100%
.
@@ Coverage Diff @@
## develop #478 +/- ##
===========================================
+ Coverage 79.87% 80.41% +0.54%
===========================================
Files 176 177 +1
Lines 2216 2242 +26
===========================================
+ Hits 1770 1803 +33
+ Misses 446 439 -7
Impacted Files | Coverage Δ | |
---|---|---|
...lib/core/data/model/promotion/order_eligibility.ex | 100% <ø> (ø) |
:arrow_up: |
apps/snitch_core/lib/core/data/model/order.ex | 73.68% <ø> (+15.78%) |
:arrow_up: |
apps/snitch_core/lib/core/data/model/line_item.ex | 87.5% <ø> (ø) |
:arrow_up: |
apps/snitch_core/lib/core/domain/promotion/cart.ex | 100% <100%> (ø) |
|
...core/data/model/adjustment/promotion_adjustment.ex | 97.82% <100%> (+0.04%) |
:arrow_up: |
...ch_core/lib/core/data/model/promotion/promotion.ex | 90.47% <100%> (+7.54%) |
:arrow_up: |
..._core/lib/core/data/model/general_configuration.ex | 63.63% <0%> (-9.1%) |
:arrow_down: |
apps/snitch_core/lib/core/data/schema/order.ex | 100% <0%> (+13.33%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update d33176c...f024b0c. Read the comment docs.