Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Side by Side Diff: appengine/chromium_cq_status/handlers/stats_data_points.py

Issue 2111713004: Teach CQ status app to check login status of users. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Review and tests. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import webapp2 5 import webapp2
6 6
7 from model.cq_stats import CQStats 7 from model.cq_stats import CQStats
8 from shared.utils import cross_origin_json 8 from shared import utils
9
9 10
10 class StatsDataPoints(webapp2.RequestHandler): 11 class StatsDataPoints(webapp2.RequestHandler):
11 @cross_origin_json 12 @utils.cross_origin_json
13 @utils.read_access
12 def get(self, ranking, name, cq_stats_key): # pylint: disable=R0201 14 def get(self, ranking, name, cq_stats_key): # pylint: disable=R0201
13 cq_stats = CQStats.get_by_id(int(cq_stats_key)) 15 cq_stats = CQStats.get_by_id(int(cq_stats_key))
14 assert cq_stats, '%s must match a CQStats entry.' % cq_stats_key 16 assert cq_stats, '%s must match a CQStats entry.' % cq_stats_key
15 for stats in cq_stats.count_stats + cq_stats.list_stats: 17 for stats in cq_stats.count_stats + cq_stats.list_stats:
16 if stats.name == name: 18 if stats.name == name:
17 if ranking == 'lowest': 19 if ranking == 'lowest':
18 return stats.lowest_100 20 return stats.lowest_100
19 assert ranking == 'highest' 21 assert ranking == 'highest'
20 return stats.highest_100 22 return stats.highest_100
21 assert False, '%s must match a stat in the specified CQStats entry.' % name 23 assert False, '%s must match a stat in the specified CQStats entry.' % name
OLDNEW
« no previous file with comments | « appengine/chromium_cq_status/handlers/recent.py ('k') | appengine/chromium_cq_status/handlers/stats_query.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698