@@ -66,49 +66,49 @@ class SummaryController(BaseController):
c.commit_data = self.__get_commit_stats(c.repo_info)
return render('summary/summary.html')
def __get_commit_stats(self, repo):
aggregate = OrderedDict()
#graph range
td = datetime.today() + timedelta(days=1)
y = td.year
m = td.month
d = td.day
c.ts_min = mktime((y, (td - timedelta(days=calendar.mdays[m] - 1)).month,
d, 0, 0, 0, 0, 0, 0,))
c.ts_max = mktime((y, m, d, 0, 0, 0, 0, 0, 0,))
def author_key_cleaner(k):
k = person(k)
k = k.replace('"', "'") #for js data compatibilty
return k
for cs in repo:
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('-')]
timetupple.extend([0 for _ in xrange(6)])
k = mktime(timetupple)
if aggregate.has_key(author_key_cleaner(cs.author)):
if aggregate[author_key_cleaner(cs.author)].has_key(k):
aggregate[author_key_cleaner(cs.author)][k]["commits"] += 1
aggregate[author_key_cleaner(cs.author)][k]["added"] += len(cs.added)
aggregate[author_key_cleaner(cs.author)][k]["changed"] += len(cs.changed)
aggregate[author_key_cleaner(cs.author)][k]["removed"] += len(cs.removed)
else:
#aggregate[author_key_cleaner(cs.author)].update(dates_range)
if k >= c.ts_min and k <= c.ts_max:
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)
aggregate[author_key_cleaner(cs.author)][k]["changed"] = len(cs.changed)
aggregate[author_key_cleaner(cs.author)][k]["removed"] = len(cs.removed)
aggregate[author_key_cleaner(cs.author)] = OrderedDict()
Status change: