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

Unified Diff: appengine/chromium_try_flakes/handlers/all_flake_occurrences.py

Issue 1945903004: Add show-all feature to the all-flake-occurrences page (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@deprecate_bug_friendly
Patch Set: Addressed comments Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/chromium_try_flakes/templates/all_flake_occurrences.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/chromium_try_flakes/handlers/all_flake_occurrences.py
diff --git a/appengine/chromium_try_flakes/handlers/all_flake_occurrences.py b/appengine/chromium_try_flakes/handlers/all_flake_occurrences.py
index d36d38811bd98d542c5a05fc0da62e3207767e3c..f0d34c9a6e7823f3bf792a2f1d1511e306cd335e 100644
--- a/appengine/chromium_try_flakes/handlers/all_flake_occurrences.py
+++ b/appengine/chromium_try_flakes/handlers/all_flake_occurrences.py
@@ -14,6 +14,7 @@ import webapp2
MAX_GROUP_DISTANCE = datetime.timedelta(days=3)
+MAX_OCCURRENCES_DEFAULT = 50
def RunsSortFunction(s): # pragma: no cover
@@ -22,12 +23,9 @@ def RunsSortFunction(s): # pragma: no cover
def filterNone(elements):
return [e for e in elements if e is not None]
-def show_all_flakes(flake): # pragma: no cover
- occurrence_keys = []
- for o in flake.occurrences:
- occurrence_keys.append(o)
-
- occurrences = filterNone(ndb.get_multi(occurrence_keys))
+def show_all_flakes(flake, show_all): # pragma: no cover
+ from_index = 0 if show_all else -MAX_OCCURRENCES_DEFAULT
+ occurrences = filterNone(ndb.get_multi(flake.occurrences[from_index:]))
failure_runs_keys = []
patchsets_keys = []
@@ -77,9 +75,12 @@ def show_all_flakes(flake): # pragma: no cover
current_group = [f]
grouped_runs.append(current_group)
+ show_all_link = (len(flake.occurrences) > MAX_OCCURRENCES_DEFAULT and
+ not show_all)
values = {
'flake': flake,
'grouped_runs': grouped_runs,
+ 'show_all_link': show_all_link,
'time_now': datetime.datetime.utcnow(),
}
@@ -89,9 +90,10 @@ class AllFlakeOccurrences(webapp2.RequestHandler): # pragma: no cover
def get(self):
key = self.request.get('key')
flake = ndb.Key(urlsafe=key).get()
+ show_all = self.request.get('show_all', 0)
if not flake:
self.response.set_status(404, 'Flake with id %s does not exist' % key)
return
- self.response.write(show_all_flakes(flake))
+ self.response.write(show_all_flakes(flake, show_all))
« no previous file with comments | « no previous file | appengine/chromium_try_flakes/templates/all_flake_occurrences.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698