From 388fa19224779b2320145dd8b101adb28629ac07 Mon Sep 17 00:00:00 2001 From: Brian Simpson Date: Wed, 11 Sep 2013 15:15:50 -0400 Subject: [PATCH] RenderableCampaign: wait to convert bid and spent floats to strings. Comparing the string values can give incorrect result when checking if a campaign is underdelivered. --- r2/r2/lib/promote.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/r2/r2/lib/promote.py b/r2/r2/lib/promote.py index a10c27f16..1c6197960 100644 --- a/r2/r2/lib/promote.py +++ b/r2/r2/lib/promote.py @@ -189,8 +189,8 @@ class RenderableCampaign(): self.start_date = start_date self.end_date = end_date self.duration = duration - self.bid = bid - self.spent = spent + self.bid = "%.2f" % bid + self.spent = "%.2f" % spent self.cpm = cpm self.sr = sr self.status = status @@ -210,8 +210,8 @@ class RenderableCampaign(): ndays = camp.ndays duration = strings.time_label % dict(num=ndays, time=ungettext("day", "days", ndays)) - bid = "%.2f" % camp.bid - spent = "%.2f" % get_spent_amount(camp) + bid = camp.bid + spent = get_spent_amount(camp) cpm = getattr(camp, 'cpm', g.cpm_selfserve.pennies) sr = camp.sr_name live = camp._id in live_campaigns