aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVikraman Choudhury <vikraman.choudhury@gmail.com>2011-08-21 20:11:37 +0530
committerVikraman Choudhury <vikraman.choudhury@gmail.com>2011-08-21 20:11:37 +0530
commit858ed9350a3115195509d0fbc1cf11a5b9a80750 (patch)
tree69fd44aa906b43a028d7395b29c621f8b459c718 /server/kwd.py
parentcommented gentoostats-send (diff)
downloadgentoostats-858ed9350a3115195509d0fbc1cf11a5b9a80750.tar.gz
gentoostats-858ed9350a3115195509d0fbc1cf11a5b9a80750.tar.bz2
gentoostats-858ed9350a3115195509d0fbc1cf11a5b9a80750.zip
commented server code
Diffstat (limited to 'server/kwd.py')
-rw-r--r--server/kwd.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/server/kwd.py b/server/kwd.py
index 779ac61..d9b30e2 100644
--- a/server/kwd.py
+++ b/server/kwd.py
@@ -4,13 +4,18 @@ from config import render, db
class Keyword(object):
def GET(self):
- keyword_count = db.query('SELECT KEYWORD, COUNT(DISTINCT IPKEY) AS PACKAGES, COUNT(DISTINCT UUID) AS HOSTS FROM GLOBAL_KEYWORDS NATURAL JOIN KEYWORDS NATURAL JOIN INSTALLED_PACKAGES GROUP BY KEYWORD')
+ keyword_count = db.query('SELECT KEYWORD,\
+ COUNT(DISTINCT IPKEY) AS PACKAGES,\
+ COUNT(DISTINCT UUID) AS HOSTS\
+ FROM GLOBAL_KEYWORDS NATURAL JOIN KEYWORDS\
+ NATURAL JOIN INSTALLED_PACKAGES GROUP BY KEYWORD')
keyword_data = dict()
for t in keyword_count:
keyword_data[t['KEYWORD']] = {'HOSTS':t['HOSTS'], 'PACKAGES':t['PACKAGES']}
if helpers.is_json_request():
return helpers.serialize(keyword_data)
else:
+ # generate plot
x_ticklabels = keyword_data.keys()
y_values = [ keyword_data[k]['PACKAGES'] for k in x_ticklabels ]
keyword_plot = helpers.barchart(title = 'Installed packages per keyword',