Skip to content

Commit a424cb1

Browse files
authored
Fix rescaler issue (#1178)
1 parent 1418e3a commit a424cb1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

merino/curated_recommendations/sections.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
)
2222
from merino.curated_recommendations.localization import get_translation
2323
from merino.curated_recommendations.prior_backends.experiment_rescaler import (
24+
DefaultRescaler,
2425
SchedulerHoldbackRescaler,
2526
SUBTOPIC_EXPERIMENT_CURATED_ITEM_FLAG,
2627
)
@@ -320,10 +321,11 @@ def get_ranking_rescaler_for_branch(
320321
request: CuratedRecommendationsRequest,
321322
) -> ExperimentRescaler | None:
322323
"""Get the correct interactions and prior rescaler for the current experiment"""
323-
if request.region != "US" or not is_scheduler_holdback_experiment(request):
324-
return None
325-
else:
324+
if is_scheduler_holdback_experiment(request):
326325
return SchedulerHoldbackRescaler()
326+
if request.region == "US":
327+
return DefaultRescaler()
328+
return None
327329

328330

329331
def update_received_feed_rank(sections: dict[str, Section]):

tests/unit/curated_recommendations/test_sections.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ def test_custom_sections_experiment_flag(self, name, branch, expected):
250250
"US",
251251
SchedulerHoldbackRescaler,
252252
),
253-
("other", "treatment", "US", None),
253+
("other", "treatment", "US", DefaultRescaler),
254254
("other", "treatment", "CA", None),
255-
(None, None, "US", None),
255+
(None, None, "US", DefaultRescaler),
256256
(None, None, "CA", None),
257257
],
258258
)

0 commit comments

Comments
 (0)