summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/stat_graph_contributors_util.js.coffee
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-05-25 15:43:22 +0200
committerDouwe Maan <douwe@gitlab.com>2015-05-25 15:43:22 +0200
commit2fa5c7513e77ecf990cdcf2d4fe7ecad82d8d7c9 (patch)
tree37d7553f8cf809f638c128d272b6e91e822c454c /app/assets/javascripts/stat_graph_contributors_util.js.coffee
parent84cb0dcbcd361730afcfbc72ea4aa7d9204f12d4 (diff)
downloadgitlab-ce-2fa5c7513e77ecf990cdcf2d4fe7ecad82d8d7c9.tar.gz
Group project contributions by both name and email.
Diffstat (limited to 'app/assets/javascripts/stat_graph_contributors_util.js.coffee')
-rw-r--r--app/assets/javascripts/stat_graph_contributors_util.js.coffee20
1 files changed, 13 insertions, 7 deletions
diff --git a/app/assets/javascripts/stat_graph_contributors_util.js.coffee b/app/assets/javascripts/stat_graph_contributors_util.js.coffee
index 1670f5c7bc1..cfe5508290f 100644
--- a/app/assets/javascripts/stat_graph_contributors_util.js.coffee
+++ b/app/assets/javascripts/stat_graph_contributors_util.js.coffee
@@ -2,11 +2,15 @@ window.ContributorsStatGraphUtil =
parse_log: (log) ->
total = {}
by_author = {}
+ by_email = {}
for entry in log
@add_date(entry.date, total) unless total[entry.date]?
- @add_author(entry, by_author) unless by_author[entry.author_name]?
- @add_date(entry.date, by_author[entry.author_name]) unless by_author[entry.author_name][entry.date]
- @store_data(entry, total[entry.date], by_author[entry.author_name][entry.date])
+
+ data = by_author[entry.author_name] #|| by_email[entry.author_email]
+ data ?= @add_author(entry, by_author, by_email)
+
+ @add_date(entry.date, data) unless data[entry.date]
+ @store_data(entry, total[entry.date], data[entry.date])
total = _.toArray(total)
by_author = _.toArray(by_author)
total: total, by_author: by_author
@@ -15,10 +19,12 @@ window.ContributorsStatGraphUtil =
collection[date] = {}
collection[date].date = date
- add_author: (author, by_author) ->
- by_author[author.author_name] = {}
- by_author[author.author_name].author_name = author.author_name
- by_author[author.author_name].author_email = author.author_email
+ add_author: (author, by_author, by_email) ->
+ data = {}
+ data.author_name = author.author_name
+ data.author_email = author.author_email
+ by_author[author.author_name] = data
+ by_email[author.author_email] = data
store_data: (entry, total, by_author) ->
@store_commits(total, by_author)