|
|
@ -461,6 +461,8 @@ update
|
|
|
|
data = graph_commits_per_author(@repository)
|
|
|
|
data = graph_commits_per_author(@repository)
|
|
|
|
when "author_commits_per_month"
|
|
|
|
when "author_commits_per_month"
|
|
|
|
data = graph_author_commits_per_month(@repository)
|
|
|
|
data = graph_author_commits_per_month(@repository)
|
|
|
|
|
|
|
|
when "author_commits_six_month"
|
|
|
|
|
|
|
|
data = author_commits_six_month(@repository)
|
|
|
|
when "author_qoc_per_author"
|
|
|
|
when "author_qoc_per_author"
|
|
|
|
data = graph_author_qoc_per_author(@repository)
|
|
|
|
data = graph_author_qoc_per_author(@repository)
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -540,15 +542,12 @@ update
|
|
|
|
def graph_commits_per_month(repository)
|
|
|
|
def graph_commits_per_month(repository)
|
|
|
|
@date_to = Date.today
|
|
|
|
@date_to = Date.today
|
|
|
|
@date_from = @date_to << 11
|
|
|
|
@date_from = @date_to << 11
|
|
|
|
@date_from = Date.civil(@date_from.year, @date_from.month, 1) ## Date.new(2001,2,-1) #=> #<Date: 2001-02-28 ...>
|
|
|
|
@date_from = Date.civil(@date_from.year, @date_from.month, 1)
|
|
|
|
# commits_by_day[0] 为data 【2】为count
|
|
|
|
|
|
|
|
commits_by_day = Changeset.count(
|
|
|
|
commits_by_day = Changeset.count(
|
|
|
|
:all, :group => :commit_date,
|
|
|
|
:all, :group => :commit_date,
|
|
|
|
:conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
|
|
|
|
:conditions => ["repository_id = ? AND commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
|
|
|
|
commits_by_month = [0] * 12
|
|
|
|
commits_by_month = [0] * 12
|
|
|
|
commits_by_day.each do |c|
|
|
|
|
commits_by_day.each {|c| commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last }
|
|
|
|
commits_by_month[(@date_to.month - c.first.to_date.month) % 12] += c.last
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changes_by_day = Change.count(
|
|
|
|
changes_by_day = Change.count(
|
|
|
|
:all, :group => :commit_date, :include => :changeset,
|
|
|
|
:all, :group => :commit_date, :include => :changeset,
|
|
|
@ -627,10 +626,15 @@ update
|
|
|
|
|
|
|
|
|
|
|
|
# 用户每月提交次数
|
|
|
|
# 用户每月提交次数
|
|
|
|
def graph_author_commits_per_month(repository)
|
|
|
|
def graph_author_commits_per_month(repository)
|
|
|
|
commits_by_author = Changeset.count(:all, :group => :committer, :conditions => ["repository_id = ?", repository.id])
|
|
|
|
@date_to = Date.today
|
|
|
|
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(25)
|
|
|
|
@date_from = @date_to << 1
|
|
|
|
|
|
|
|
@date_from = Date.civil(@date_from.year, @date_from.month, 1)
|
|
|
|
changes_by_author = Change.count(:all, :group => :committer, :include => :changeset, :conditions => ["#{Changeset.table_name}.repository_id = ?", repository.id])
|
|
|
|
commits_by_author = Changeset.count(:all, :group => :committer,
|
|
|
|
|
|
|
|
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
|
|
|
|
|
|
|
|
commits_by_author = commits_by_author.to_a.sort! {|x, y| x.last <=> y.last}.last(40)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
changes_by_author = Change.count(:all, :group => :committer, :include => :changeset,
|
|
|
|
|
|
|
|
:conditions => ["#{Changeset.table_name}.repository_id = ? AND #{Changeset.table_name}.commit_date BETWEEN ? AND ?", repository.id, @date_from, @date_to])
|
|
|
|
h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o}
|
|
|
|
h = changes_by_author.inject({}) {|o, i| o[i.first] = i.last; o}
|
|
|
|
|
|
|
|
|
|
|
|
fields = commits_by_author.collect {|r| r.first}
|
|
|
|
fields = commits_by_author.collect {|r| r.first}
|
|
|
@ -666,9 +670,8 @@ update
|
|
|
|
graph.burn
|
|
|
|
graph.burn
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def graph_author_qoc_per_author(repository)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def check_hidden_repo
|
|
|
|
def check_hidden_repo
|
|
|
|
project = Project.find(params[:id])
|
|
|
|
project = Project.find(params[:id])
|
|
|
|