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

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

Issue 1950083002: Load only a few flakes on the index page and inline link to load more (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: 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/index.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/chromium_try_flakes/handlers/index.py
diff --git a/appengine/chromium_try_flakes/handlers/index.py b/appengine/chromium_try_flakes/handlers/index.py
index 438a68f0f6ce458dc3074a9636dcec1ab2a8d503..b9abd483fb782eaf65a7071e1d1122fa38e35241 100644
--- a/appengine/chromium_try_flakes/handlers/index.py
+++ b/appengine/chromium_try_flakes/handlers/index.py
@@ -18,6 +18,9 @@ import time
import webapp2
+MAX_OCCURRENCES_PER_FLAKE_ON_INDEX_PAGE = 4
+
+
def filterNone(elements):
return [e for e in elements if e is not None]
@@ -26,7 +29,8 @@ def FlakeSortFunction(s): # pragma: no cover
def GetFilteredOccurences(flake, time_formatter,
filter_function): # pragma: no cover
- occurrences = filterNone(ndb.get_multi(flake.occurrences))
+ occurrences = filterNone(ndb.get_multi(
+ flake.occurrences[-MAX_OCCURRENCES_PER_FLAKE_ON_INDEX_PAGE:]))
failure_run_keys = []
patchsets_keys = []
@@ -99,6 +103,8 @@ class Index(webapp2.RequestHandler): # pragma: no cover
for f in flakes:
f.filtered_occurrences = GetFilteredOccurences(
f, time_formatter, filter_by_range)
+ if len(f.occurrences) > MAX_OCCURRENCES_PER_FLAKE_ON_INDEX_PAGE:
+ f.more_occurrences = True
values = {
'range': time_range,
« no previous file with comments | « no previous file | appengine/chromium_try_flakes/templates/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698