diff --git a/adserver/tasks.py b/adserver/tasks.py index 3cf27c19..42bfab44 100644 --- a/adserver/tasks.py +++ b/adserver/tasks.py @@ -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"] ) diff --git a/adserver/tests/test_tasks.py b/adserver/tests/test_tasks.py index 5863849c..4f3d21fb 100644 --- a/adserver/tests/test_tasks.py +++ b/adserver/tests/test_tasks.py @@ -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()