Commit 8bda42f
committed
refactor: Simplify promo activation logic in PromoActivationService
This commit refactors the `PromoActivationService` to simplify its logic and improve readability.
Key changes include:
- Removed redundant `user_age is None` checks in the age targeting validation, assuming `user_age` is always present.
- Streamlined the promo code acquisition process by removing unnecessary conditional branches and `PromoUnavailableError` exceptions.
- Eliminated an unreachable `PromoActivationError`, making the code path for activating a promotion more direct.1 parent ddaeb73 commit 8bda42f
1 file changed
+3
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
84 | | - | |
| 82 | + | |
85 | 83 | | |
86 | 84 | | |
87 | | - | |
88 | | - | |
89 | | - | |
| 85 | + | |
90 | 86 | | |
91 | 87 | | |
92 | 88 | | |
| |||
127 | 123 | | |
128 | 124 | | |
129 | 125 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
| 126 | + | |
134 | 127 | | |
135 | 128 | | |
136 | 129 | | |
| |||
139 | 132 | | |
140 | 133 | | |
141 | 134 | | |
142 | | - | |
143 | | - | |
144 | 135 | | |
145 | 136 | | |
146 | 137 | | |
| |||
149 | 140 | | |
150 | 141 | | |
151 | 142 | | |
152 | | - | |
153 | | - | |
154 | 143 | | |
155 | 144 | | |
0 commit comments