# HG changeset patch # User Marcin Kuzminski # Date 1284859789 -7200 # Node ID b12ea84fb9061ebed9f3ea4e95499559573af2e8 # Parent 5c376ac2d4c9ec01c298d1fc4351d3678fb68233 Some fixes to summary, and total rewrite of summary graphs implemented more interactive graph. Some small fixes for tasks (sorting,limit) diff -r 5c376ac2d4c9 -r b12ea84fb906 pylons_app/lib/celerylib/__init__.py --- a/pylons_app/lib/celerylib/__init__.py Sat Sep 18 17:03:29 2010 +0200 +++ b/pylons_app/lib/celerylib/__init__.py Sun Sep 19 03:29:49 2010 +0200 @@ -14,13 +14,16 @@ def result(self): return self.task -def run_task(task,*args,**kwargs): +def run_task(task, *args, **kwargs): try: - t = task.delay(*args,**kwargs) - log.info('running task %s',t.task_id) + t = task.delay(*args, **kwargs) + log.info('running task %s', t.task_id) return t - except: - log.error(traceback.format_exc()) + except Exception, e: + if e.errno == 111: + log.debug('Unnable to connect. Sync execution') + else: + log.error(traceback.format_exc()) #pure sync version - return ResultWrapper(task(*args,**kwargs)) - \ No newline at end of file + return ResultWrapper(task(*args, **kwargs)) + diff -r 5c376ac2d4c9 -r b12ea84fb906 pylons_app/lib/celerylib/tasks.py --- a/pylons_app/lib/celerylib/tasks.py Sat Sep 18 17:03:29 2010 +0200 +++ b/pylons_app/lib/celerylib/tasks.py Sun Sep 19 03:29:49 2010 +0200 @@ -7,8 +7,9 @@ from pylons_app.lib.helpers import person from pylons_app.lib.smtp_mailer import SmtpMailer from pylons_app.lib.utils import OrderedDict +from operator import itemgetter +from vcs.backends.hg import MercurialRepository from time import mktime -from vcs.backends.hg import MercurialRepository import calendar import traceback import json @@ -98,13 +99,14 @@ d, 0, 0, 0, 0, 0, 0,)) ts_max_y = mktime((y, m, d, 0, 0, 0, 0, 0, 0,)) - + skip_date_limit = True + def author_key_cleaner(k): k = person(k) k = k.replace('"', "") #for js data compatibilty return k - for cs in repo[:1000]:#added limit 200 until fix #29 is made + for cs in repo[:200]:#added limit 200 until fix #29 is made k = '%s-%s-%s' % (cs.date.timetuple()[0], cs.date.timetuple()[1], cs.date.timetuple()[2]) timetupple = [int(x) for x in k.split('-')] @@ -119,7 +121,7 @@ else: #aggregate[author_key_cleaner(cs.author)].update(dates_range) - if k >= ts_min_y and k <= ts_max_y: + if k >= ts_min_y and k <= ts_max_y or skip_date_limit: aggregate[author_key_cleaner(cs.author)][k] = {} aggregate[author_key_cleaner(cs.author)][k]["commits"] = 1 aggregate[author_key_cleaner(cs.author)][k]["added"] = len(cs.added) @@ -127,7 +129,7 @@ aggregate[author_key_cleaner(cs.author)][k]["removed"] = len(cs.removed) else: - if k >= ts_min_y and k <= ts_max_y: + if k >= ts_min_y and k <= ts_max_y or skip_date_limit: aggregate[author_key_cleaner(cs.author)] = OrderedDict() #aggregate[author_key_cleaner(cs.author)].update(dates_range) aggregate[author_key_cleaner(cs.author)][k] = {} @@ -145,15 +147,19 @@ overview_data = [] for k, v in overview_aggregate.items(): overview_data.append([k, v]) + overview_data = sorted(overview_data, key=itemgetter(0)) data = {} for author in aggregate: - data[author] = {"label":author, - "data":[{"time":x, + commit_data = sorted([{"time":x, "commits":aggregate[author][x]['commits'], "added":aggregate[author][x]['added'], "changed":aggregate[author][x]['changed'], "removed":aggregate[author][x]['removed'], } for x in aggregate[author]], + key=itemgetter('time')) + + data[author] = {"label":author, + "data":commit_data, "schema":["commits"] } diff -r 5c376ac2d4c9 -r b12ea84fb906 pylons_app/templates/summary/summary.html --- a/pylons_app/templates/summary/summary.html Sat Sep 18 17:03:29 2010 +0200 +++ b/pylons_app/templates/summary/summary.html Sun Sep 19 03:29:49 2010 +0200 @@ -76,7 +76,9 @@
- ${h.age(c.repo_info.last_change)} - ${h.rfc822date(c.repo_info.last_change)} + ${h.age(c.repo_info.last_change)} - ${h.rfc822date(c.repo_info.last_change)} + ${_('by')} ${c.repo_info.get_changeset('tip').author} +
@@ -121,7 +123,7 @@
-
${_('Last month commit activity')}
+
${_('Commit activity')}
@@ -136,191 +138,341 @@
+ YAHOO.util.Event.on(choiceContainer.getElementsByTagName("input"), "click", plotchoiced, [data, initial_ranges]); + } + SummaryPlot(${c.ts_min},${c.ts_max},${c.commit_data|n},${c.overview_data|n}); +