From e6bfc29316d397a881bdf60d7d08ab294436303c Mon Sep 17 00:00:00 2001 From: Brian Simpson Date: Wed, 14 Aug 2013 16:39:52 -0400 Subject: [PATCH] Use a very conservative estimate of ad inventory. Inventory is estimated using traffic to GET_listing. This is a pretty good estimate based on historical trends (compare subreddit traffic to impressions for promoted links targeted to the subreddit). It seems safer to start out with a low estimate. This is especially needed because the CPM beta will only show promoted links on the subreddit listing, not on multireddits or the front page. --- r2/r2/lib/inventory.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/r2/r2/lib/inventory.py b/r2/r2/lib/inventory.py index 6453d4d3f..3315c822c 100644 --- a/r2/r2/lib/inventory.py +++ b/r2/r2/lib/inventory.py @@ -136,8 +136,9 @@ def get_available_pageviews(srs, start, end, datestr=False): ret = {} for sr in srs: sold_by_date = sold_by_sr_by_date[sr.name] + sr_ad_inventory = int(daily_inventory.get(sr.name, 0) * 0.5) ret[sr.name] = { - datekey(date): max(0, daily_inventory.get(sr.name, 0) - sold) + datekey(date): max(0, sr_ad_inventory - sold) for date, sold in sold_by_date.iteritems() }