Skip to content

Commit

Permalink
Change the publisher alert from views to revenue
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfischer committed Feb 14, 2024
1 parent 8ec9545 commit b6b51d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion adserver/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ def notify_of_publisher_changes(difference_threshold=0.25, min_views=10_000):
previous_week_report = PublisherReport(queryset)
previous_week_report.generate()

for metric in ("views",):
for metric in ("revenue",):
total_views = (
last_week_report.total["views"] + previous_week_report.total["views"]
)
Expand Down
8 changes: 5 additions & 3 deletions adserver/tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,14 @@ def test_notify_of_publisher_changes(self):
backend.reset_messages()
notify_of_publisher_changes(min_views=100)

# Should be 1 message: one for views with CTR being within the threshold
# Should be 1 message: one for revenue with CTR being within the threshold
# Ads are $2 CPC
messages = backend.retrieve_messages()
self.assertEqual(len(messages), 1, messages)
self.assertTrue(
'"views" was 55 last week and 111 the previous week (-50.45%)'
in messages[0]["text"]
'"revenue" was 10 last week and 22 the previous week (-54.55%)'
in messages[0]["text"],
messages[0]["text"],
)

backend.reset_messages()
Expand Down

0 comments on commit b6b51d1

Please sign in to comment.