mirror of https://github.com/tomgi/git_stats.git
changed lines = insertions + deletions
This commit is contained in:
parent
7af4c6facf
commit
b1713e3bff
|
@ -36,11 +36,13 @@ en:
|
|||
commits_by_date: Commits by date
|
||||
insertions_by_author: Lines added by author
|
||||
deletions_by_author: Lines deleted by author
|
||||
changed_lines_by_author: Changed lines by author
|
||||
best_authors_shown: best authors shown
|
||||
commits_count_by_author: Commits count by author
|
||||
commits_sum_by_author_by_date: Commits sum by author by date
|
||||
insertions_by_author_by_date: Lines added by author by date
|
||||
deletions_by_author_by_date: Lines deleted by author by date
|
||||
changed_lines_by_author_by_date: Changed lines by author by date
|
||||
best_authors: Best authors
|
||||
insertions: Lines added
|
||||
deletions: Lines deleted
|
||||
|
|
|
@ -11,6 +11,10 @@ module GitStats
|
|||
@commits ||= repo.commits.select { |commit| commit.author == self }
|
||||
end
|
||||
|
||||
def changed_lines
|
||||
insertions + deletions
|
||||
end
|
||||
|
||||
def insertions
|
||||
short_stats.map(&:insertions).sum
|
||||
end
|
||||
|
@ -27,7 +31,7 @@ module GitStats
|
|||
}
|
||||
end
|
||||
|
||||
[:insertions, :deletions].each do |method|
|
||||
[:insertions, :deletions, :changed_lines].each do |method|
|
||||
define_method "#{method}_by_date" do
|
||||
sum = 0
|
||||
commits.map { |commit|
|
||||
|
|
|
@ -41,7 +41,7 @@ module GitStats
|
|||
Hash[authors.map { |author| [author, author.commits.size] }.sort_by { |author, commits| -commits }[0..limit]]
|
||||
end
|
||||
|
||||
[:insertions, :deletions].each do |method|
|
||||
[:insertions, :deletions, :changed_lines].each do |method|
|
||||
define_method "#{method}_by_author" do |limit = 4|
|
||||
Hash[authors.map { |author| [author, author.send(method)] }.sort_by { |author, lines| -lines }[0..limit]]
|
||||
end
|
||||
|
|
|
@ -8,6 +8,10 @@ module GitStats
|
|||
calculate_stat
|
||||
end
|
||||
|
||||
def changed_lines
|
||||
insertions + deletions
|
||||
end
|
||||
|
||||
def to_s
|
||||
"#{self.class} #@commit"
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ module GitStats
|
|||
end
|
||||
end
|
||||
|
||||
[:insertions, :deletions].each do |method|
|
||||
[:insertions, :deletions, :changed_lines].each do |method|
|
||||
define_method "#{method}_by_author_by_date" do |limit = 4|
|
||||
Chart.new do |f|
|
||||
f.multi_date_chart(
|
||||
|
|
|
@ -2,10 +2,11 @@ module GitStats
|
|||
module StatsView
|
||||
module Charts
|
||||
class All
|
||||
delegate :files_by_extension, :lines_by_extension, :files_by_date, :lines_by_date,
|
||||
:commits_count_by_author, :insertions_by_author, :deletions_by_author, to: :repo_charts
|
||||
delegate :files_by_extension, :lines_by_extension, :files_by_date, :lines_by_date, :commits_count_by_author,
|
||||
:changed_lines_by_author, :insertions_by_author, :deletions_by_author, to: :repo_charts
|
||||
|
||||
delegate :commits_sum_by_author_by_date, :insertions_by_author_by_date, :deletions_by_author_by_date, to: :authors_charts
|
||||
delegate :commits_sum_by_author_by_date, :changed_lines_by_author_by_date,
|
||||
:insertions_by_author_by_date, :deletions_by_author_by_date, to: :authors_charts
|
||||
|
||||
delegate :activity_by_date, :activity_by_hour, :activity_by_wday, :activity_by_month,
|
||||
:activity_by_year, to: :activity_charts
|
||||
|
|
|
@ -46,7 +46,7 @@ module GitStats
|
|||
end
|
||||
end
|
||||
|
||||
[:commits_count_by_author, :insertions_by_author, :deletions_by_author].each do |method|
|
||||
[:commits_count_by_author, :insertions_by_author, :deletions_by_author, :changed_lines_by_author].each do |method|
|
||||
define_method method do
|
||||
Chart.new do |f|
|
||||
f.column_hash_chart(
|
||||
|
|
|
@ -4,12 +4,16 @@
|
|||
%a{:href => '#best_authors', 'data-toogle' => 'tab'}= :best_authors.t
|
||||
%li
|
||||
%a{:href => '#commits_count_by_author', 'data-toogle' => 'tab'}= :commits_count_by_author.t
|
||||
%li
|
||||
%a{:href => '#changed_lines_by_author', 'data-toogle' => 'tab'}= :changed_lines_by_author.t
|
||||
%li
|
||||
%a{:href => '#insertions_by_author', 'data-toogle' => 'tab'}= :insertions_by_author.t
|
||||
%li
|
||||
%a{:href => '#deletions_by_author', 'data-toogle' => 'tab'}= :deletions_by_author.t
|
||||
%li
|
||||
%a{:href => '#commits_sum_by_author_by_date', 'data-toogle' => 'tab'}= :commits_sum_by_author_by_date.t
|
||||
%li
|
||||
%a{:href => '#changed_lines_by_author_by_date', 'data-toogle' => 'tab'}= :changed_lines_by_author_by_date.t
|
||||
%li
|
||||
%a{:href => '#insertions_by_author_by_date', 'data-toogle' => 'tab'}= :insertions_by_author_by_date.t
|
||||
%li
|
||||
|
@ -58,6 +62,13 @@
|
|||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'changed_lines_by_author'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :changed_lines_by_author.t
|
||||
= high_chart("charts.changed_lines_by_author", charts.changed_lines_by_author)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'insertions_by_author'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :insertions_by_author.t
|
||||
|
@ -68,7 +79,7 @@
|
|||
.tab-pane{id: 'deletions_by_author'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :deletions_by_author.t
|
||||
= high_chart("charts.deletions_by_author", charts.insertions_by_author)
|
||||
= high_chart("charts.deletions_by_author", charts.deletions_by_author)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
|
@ -86,6 +97,13 @@
|
|||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'changed_lines_by_author_by_date'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :changed_lines_by_author_by_date.t
|
||||
= high_stock("charts.changed_lines_by_author_by_date", charts.changed_lines_by_author_by_date)
|
||||
%small
|
||||
%center= "5 #{:best_authors_shown.t}"
|
||||
|
||||
.tab-pane{id: 'deletions_by_author_by_date'}
|
||||
.page-header
|
||||
%h1.pagination-centered= :deletions_by_author_by_date.t
|
||||
|
|
Loading…
Reference in New Issue