PromoteReport uses id36s rather than fullnames.

This commit is contained in:
bsimpson63
2013-06-11 15:52:11 -04:00
parent 121d947824
commit 9329960f4b
3 changed files with 15 additions and 15 deletions

View File

@@ -771,13 +771,13 @@ class PromoteController(ListingController):
start = start or end - timedelta(days=7)
if link_text is not None:
names = link_text.replace(',', ' ').split()
id36s = link_text.replace(',', ' ').split()
try:
links = Link._by_fullname(names, data=True)
links = Link._byID36(id36s, data=True)
except NotFound:
links = {}
bad_links = [name for name in names if name not in links]
bad_links = [id36 for id36 in id36s if id36 not in links]
links = links.values()
else:
links = []

View File

@@ -3806,22 +3806,22 @@ class PromoteReport(Templated):
writer.writerow([])
writer.writerow((_("links"),))
writer.writerow((
_("name"),
_("id"),
_("owner"),
_("comments"),
_("upvotes"),
_("downvotes"),
))
for row in self.link_report:
writer.writerow((row['name'], row['owner'], row['comments'],
writer.writerow((row['id36'], row['owner'], row['comments'],
row['upvotes'], row['downvotes']))
writer.writerow([])
writer.writerow((_("campaigns"),))
writer.writerow((
_("link"),
_("link id"),
_("owner"),
_("campaign"),
_("campaign id"),
_("target"),
_("bid"),
_("frontpage clicks"), _("frontpage impressions"),
@@ -3844,7 +3844,7 @@ class PromoteReport(Templated):
for link in self.links:
row = {
'name': link._fullname,
'id36': link._id36,
'owner': owners[link.author_id].name,
'comments': link.num_comments,
'upvotes': link._ups,
@@ -3909,9 +3909,9 @@ class PromoteReport(Templated):
- max(camp.start_date, self.start)).days
bid = camp.bid * (float(effective_duration) / camp_duration)
row = {
'link': link._fullname,
'link': link._id36,
'owner': owners[link.author_id].name,
'campaign': fullname,
'campaign': camp._id36,
'target': camp.sr_name or 'frontpage',
'bid': format_currency(bid, 'USD', locale=c.locale),
'fp_impressions': fp_imps[fullname],

View File

@@ -51,7 +51,7 @@ ${unsafe(js.use('sponsored'))}
function(elem) { return elem; }
</%pr:datepicker>
<h2>link names</h2>
<h2>link ids</h2>
<textarea name="link_text" rows="5" cols="80">
${thing.link_text}
</textarea>
@@ -70,7 +70,7 @@ ${unsafe(js.use('sponsored'))}
<table id="link-report" class="promote-report-table">
<thead>
<tr>
<th>name</th>
<th>id</th>
<th>owner</th>
<th>comments</th>
<th>upvotes</th>
@@ -80,7 +80,7 @@ ${unsafe(js.use('sponsored'))}
<tbody>
%for row in thing.link_report:
<tr>
<td class="text">${row['name']}</td>
<td class="text">${row['id36']}</td>
<td class="text">${row['owner']}</td>
<td>${format_number(row['comments'])}</td>
<td>${format_number(row['upvotes'])}</td>
@@ -106,9 +106,9 @@ ${unsafe(js.use('sponsored'))}
<th colspan="2">total</th>
</tr>
<tr>
<th>link</th>
<th>link id</th>
<th>owner</th>
<th>campaign</th>
<th>campaign id</th>
<th>target</th>
<th>bid</th>
<th>clicks</th>