summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2011-02-08 15:19:24 +0100
committerjasplin <qt-info@nokia.com>2011-02-08 15:19:24 +0100
commit7a2e5cc1f32a49d52384b311853c79b526738778 (patch)
tree12191bfc22e36a5be15c8dc11c85b7082731c438
parent223b7560f5e823d99d4873aa4a6715ddf811f482 (diff)
Indicate for which snapshots rankings are available.
An 'R' in front of the SHA-1 indicates that rankings have been computed (and is available in the database) for this snapshot.
-rw-r--r--scripts/listcontexts.py15
-rw-r--r--web/getstats/main.js4
2 files changed, 16 insertions, 3 deletions
diff --git a/scripts/listcontexts.py b/scripts/listcontexts.py
index 3de1d53..2a513a5 100644
--- a/scripts/listcontexts.py
+++ b/scripts/listcontexts.py
@@ -5,6 +5,13 @@ from dbaccess import execQuery
from misc import idToText, printJSONHeader
class ListContexts:
+
+ def rankingsExist(self, contextId):
+ rankings = execQuery(
+ "SELECT id FROM ranking WHERE context2Id = %d LIMIT 1;" % contextId)
+ return len(rankings) > 0
+
+
def execute(self):
# Get all host/platform/branch/sha1 combinations:
@@ -23,7 +30,9 @@ class ListContexts:
id, host, platform, branch, sha1, timestamp = contexts[0]
curHost, curPlatform, curBranch = host, platform, branch
- curSnapshots = [(idToText('sha1', sha1), timestamp, id)]
+ curSnapshots = [
+ (idToText('sha1', sha1), timestamp,
+ 1 if self.rankingsExist(id) else 0)]
for (id, host, platform, branch, sha1, timestamp) in contexts[1:]:
if (host, platform, branch) != (curHost, curPlatform, curBranch):
@@ -37,7 +46,9 @@ class ListContexts:
curHost, curPlatform, curBranch = host, platform, branch
curSnapshots = []
- curSnapshots.append((idToText('sha1', sha1), timestamp, id))
+ curSnapshots.append(
+ (idToText('sha1', sha1), timestamp,
+ 1 if self.rankingsExist(id) else 0))
self.writeOutput()
diff --git a/web/getstats/main.js b/web/getstats/main.js
index 302cc9e..3f7ba59 100644
--- a/web/getstats/main.js
+++ b/web/getstats/main.js
@@ -366,7 +366,9 @@ function fetchContexts() {
"background-color:" + ageColor_ +
"; font-family:lucida sans typewriter, " +
"courier new\" value=\"" + sha1 +
- "\">" + sha1 + "&nbsp;&nbsp;(first upload: " +
+ "\">" +
+ (snapshot[2] ? "R&nbsp;" : "&nbsp;&nbsp;") +
+ sha1 + "&nbsp;&nbsp;(first upload: " +
secsToDays(secsAgo) +
" days ago)</option>";
}