mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 08:17:58 -05:00
Convert dates to EST for display on PromotedLinkTraffic.
This commit is contained in:
@@ -23,11 +23,13 @@
|
||||
|
||||
import collections
|
||||
import datetime
|
||||
import pytz
|
||||
import urllib
|
||||
|
||||
from pylons.i18n import _
|
||||
from pylons import g, c, request
|
||||
import babel.core
|
||||
from babel.dates import format_datetime
|
||||
|
||||
from r2.lib import promote
|
||||
from r2.lib.menus import menu
|
||||
@@ -526,7 +528,15 @@ class PromotedLinkTraffic(RedditTraffic):
|
||||
|
||||
self.total_impressions += imps
|
||||
self.total_clicks += clicks
|
||||
computed_history.append((date, data + (u_ctr, ctr)))
|
||||
|
||||
date = date.replace(tzinfo=pytz.utc)
|
||||
datestr = format_datetime(
|
||||
date,
|
||||
tzinfo=pytz.timezone("US/Eastern"),
|
||||
locale=c.locale,
|
||||
format="yyyy-MM-dd HH:mm zzz",
|
||||
)
|
||||
computed_history.append((date, datestr, data + (u_ctr, ctr)))
|
||||
|
||||
self.history = computed_history
|
||||
|
||||
|
||||
@@ -84,9 +84,9 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% for date, data in thing.history:
|
||||
% for date, datestr, data in thing.history:
|
||||
<tr>
|
||||
<th scope="col" data-value="${js_timestamp(date)}">${date}</th>
|
||||
<th scope="col" data-value="${js_timestamp(date)}">${datestr}</th>
|
||||
% for datum in data:
|
||||
<td data-value="${datum}">${format_number(datum)}</td>
|
||||
% endfor
|
||||
|
||||
@@ -67,9 +67,9 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
% for date, data in thing.history:
|
||||
% for date, datestr, data in thing.history:
|
||||
<tr>
|
||||
<th scope="col" data-value="${js_timestamp(date)}">${date}</th>
|
||||
<th scope="col" data-value="${js_timestamp(date)}">${datestr}</th>
|
||||
% for datum in data:
|
||||
<td data-value="${datum}">${format_number(datum)}</td>
|
||||
% endfor
|
||||
|
||||
Reference in New Issue
Block a user