Editor performance details does not update (bug 654612)
This commit is contained in:
Родитель
3d3cabe590
Коммит
3d46c6cf11
|
@ -197,19 +197,23 @@ class PerformanceGraph(ViewQueue):
|
|||
total = models.IntegerField()
|
||||
|
||||
def base_query(self):
|
||||
request_ver = amo.LOG.REQUEST_VERSION
|
||||
review_ids = [str(r) for r in amo.LOG_REVIEW_QUEUE if r != request_ver]
|
||||
|
||||
return {
|
||||
'select': SortedDict([
|
||||
('yearmonth', "DATE_FORMAT(`approvals`.`created`, '%%Y-%%m')"),
|
||||
('approval_created', '`approvals`.`created`'),
|
||||
('yearmonth',
|
||||
"DATE_FORMAT(`log_activity`.`created`, '%%Y-%%m')"),
|
||||
('approval_created', '`log_activity`.`created`'),
|
||||
('user_id', '`users`.`id`'),
|
||||
('total', 'COUNT(*)')]),
|
||||
'from': [
|
||||
'approvals',
|
||||
'LEFT JOIN `users` ON (`users`.`id`=`approvals`.`user_id`)',
|
||||
'log_activity',
|
||||
'LEFT JOIN `users` ON (`users`.`id`=`log_activity`.`user_id`)',
|
||||
"""INNER JOIN `groups_users` ON
|
||||
(`users`.`id` = `groups_users`.`user_id` AND
|
||||
`groups_users`.`group_id` = 2)"""],
|
||||
'where': [],
|
||||
'where': ['log_activity.action in (%s)' % ', '.join(review_ids)],
|
||||
'group_by': 'yearmonth, user_id'
|
||||
}
|
||||
|
||||
|
|
|
@ -759,20 +759,29 @@ class TestModeratedQueue(QueueTest):
|
|||
|
||||
|
||||
class TestPerformance(QueueTest):
|
||||
fixtures = ('base/users', 'editors/pending-queue', 'base/approvals')
|
||||
fixtures = ('base/users', 'editors/pending-queue')
|
||||
|
||||
"""Test the page at /editors/performance."""
|
||||
def setUp(self):
|
||||
super(TestPerformance, self).setUp()
|
||||
|
||||
self.login_as_editor()
|
||||
amo.set_user(UserProfile.objects.get(username='editor'))
|
||||
addon = Addon.objects.all()[0]
|
||||
version = addon.versions.all()[0]
|
||||
|
||||
for i in amo.LOG_REVIEW_QUEUE:
|
||||
amo.log(amo.LOG_BY_ID[i], addon, version)
|
||||
|
||||
self.url_performance = reverse('editors.performance')
|
||||
|
||||
def test_performance_chart(self):
|
||||
r = self.client.get(self.url_performance)
|
||||
doc = pq(r.content)
|
||||
|
||||
data = {u'2010-08': {u'teamcount': 1, u'teamavg': u'1.0',
|
||||
u'usercount': 1, u'teamamt': 1,
|
||||
u'label': u'Aug 2010'}}
|
||||
data = {u'2011-05': {u'teamcount': 8, u'teamavg': u'8.0',
|
||||
u'usercount': 8, u'teamamt': 1,
|
||||
u'label': u'May 2011'}}
|
||||
|
||||
eq_(json.loads(doc('#monthly').attr('data-chart')), data)
|
||||
|
||||
|
|
|
@ -165,9 +165,9 @@ def _performanceByMonth(user_id, months=12, end_month=None, end_year=None):
|
|||
1, 0, 0, 0, 0, 0, -1))
|
||||
|
||||
sql = (PerformanceGraph.objects
|
||||
.filter_raw('approvals.created >=',
|
||||
.filter_raw('log_activity.created >=',
|
||||
date.fromtimestamp(start_time).isoformat())
|
||||
.filter_raw('approvals.created <',
|
||||
.filter_raw('log_activity.created <',
|
||||
date.fromtimestamp(end_time).isoformat())
|
||||
)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче