Refactored hasActiveOffer and _getActiveDiscount to share common logic#26543
Refactored hasActiveOffer and _getActiveDiscount to share common logic#26543
hasActiveOffer and _getActiveDiscount to share common logic#26543Conversation
…logic ref https://linear.app/ghost/issue/BER-3338 Both functions independently computed discount windows using the same three data paths (trial periods, Stripe coupon data, and legacy offer duration fallback). This extracts the shared computation into a single `getDiscountWindow` utility so the two callers stay in sync as the discount model evolves.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
WalkthroughThis change introduces a new utility function 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
sagzy
left a comment
There was a problem hiding this comment.
Nice! Refactoring makes sense. Naming: getActiveDiscount instead of getDiscountWindow?
ref https://linear.app/ghost/issue/BER-3338
Both functions independently computed discount windows using the same three data paths (trial periods, Stripe coupon data, and legacy offer duration fallback). This extracts the shared computation into a single
getDiscountWindowutility so the two callers stay in sync as the discount model evolves.