Skip to content

Commit 6eef2e4

Browse files
authored
[DISCO-4026] fix: Fix casing for engagement lookups (#1361)
1 parent 7871dd8 commit 6eef2e4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

merino/providers/suggest/adm/provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def normalize_query(self, query: str) -> str:
210210

211211
def _fetch_engagement_metrics(self, suggestion: PyAmpResult) -> EngagementMetrics:
212212
"""Fetch engagement metrics for an AMP suggestion."""
213-
advertiser = suggestion.advertiser
213+
advertiser = suggestion.advertiser.lower()
214214
engaged, attempted = 1, 1
215215
if self.engagement_data and (metrics := self.engagement_data.amp.get(advertiser)):
216216
attempted = int(metrics.get("impressions", attempted))

tests/unit/providers/suggest/adm/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,12 @@ def fixture_engagement_data() -> EngagementData:
216216
"clicks": 5,
217217
},
218218
"Example.org": {
219-
"advertiser": "Example.org",
219+
"advertiser": "example.org",
220220
"impressions": 10001,
221221
"clicks": 10000,
222222
},
223223
"LowEngagement": {
224-
"advertiser": "LowEngagement",
224+
"advertiser": "lowengagement",
225225
"impressions": 9999,
226226
"clicks": 5,
227227
},
@@ -329,7 +329,7 @@ def fixture_adm_with_thompson_single_candidate_below_threshold(
329329
)
330330
provider.engagement_data = EngagementData(
331331
amp={
332-
"Example.org": {"click": 10, "impression": 100},
332+
"example.org": {"click": 10, "impression": 100},
333333
},
334334
amp_aggregated={},
335335
)

0 commit comments

Comments
 (0)