From 4d228d61ae4bb9497251c2fe9151b3ef10c5a559 Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Thu, 1 Aug 2013 20:12:54 +0400 Subject: [PATCH] Fixed retrieving of commit index from vcs Change-Id: Ic917f8f2bf734d7cb4a68eba325c686cbf7877d5 --- dashboard/templates/module_details.html | 2 +- dashboard/web.py | 8 +++++++- stackalytics/processor/vcs.py | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dashboard/templates/module_details.html b/dashboard/templates/module_details.html index f14a93453..6ebc8207f 100644 --- a/dashboard/templates/module_details.html +++ b/dashboard/templates/module_details.html @@ -34,7 +34,7 @@ {% block right_frame %} -

Recent commits

+

Recent activity

{% for rec in commits %}
diff --git a/dashboard/web.py b/dashboard/web.py index 9488844b4..a847d19c1 100644 --- a/dashboard/web.py +++ b/dashboard/web.py @@ -548,11 +548,17 @@ def timeline(records, **kwargs): week_stat_commits = dict((c, 0) for c in weeks) week_stat_commits_hl = dict((c, 0) for c in weeks) + param = get_parameter(kwargs, 'metric') + if ('reviews' in param) or ('marks' in param): + handler = lambda record: 0 + else: + handler = lambda record: record['loc'] + # fill stats with the data for record in records: week = record['week'] if week in weeks: - week_stat_loc[week] += record['loc'] + week_stat_loc[week] += handler(record) week_stat_commits[week] += 1 if 'all' in release_names or record['release'] in release_names: week_stat_commits_hl[week] += 1 diff --git a/stackalytics/processor/vcs.py b/stackalytics/processor/vcs.py index 3f735b19e..60c276a84 100644 --- a/stackalytics/processor/vcs.py +++ b/stackalytics/processor/vcs.py @@ -100,6 +100,9 @@ class Git(Vcs): self.get_release_index() def get_release_index(self): + if not os.path.exists(self.folder): + return {} + os.chdir(self.folder) if not self.release_index: for release in self.repo['releases']: