Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Add files/lines by extension by date" #78

Merged
merged 1 commit into from
Dec 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,3 @@ en:
insertions_by_date: Lines added by date
deletions_by_date: Lines deleted by date
changed_lines_by_date: Changed lines by date
lines_by_extension_by_date: Lines per extension by date
files_by_extension_by_date: Files per extension by date
53 changes: 3 additions & 50 deletions lib/git_stats/git_data/repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ def tree
@tree ||= Tree.new(repo: self, relative_path: @tree_path)
end

def command_memoization
@command_memoization_map ||= {}
end

def authors
@authors ||= run_and_parse("git shortlog -se #{commit_range} #{tree_path}").map do |author|
Author.new(repo: self, name: author[:name], email: author[:email])
Expand Down Expand Up @@ -99,44 +95,6 @@ def comments_count_by_date
}].fill_empty_days!(aggregated: true)
end

def files_by_extension_by_date
file_counts_by_date_by_extension = {}
extensions_sums = {}
commits.map do |commit|
commit.files_by_extension_count.map do |ext, count|
extensions_sums[ext] ||= 0;
extensions_sums[ext] = count;
file_counts_by_date_by_extension[ext] ||= {};
file_counts_by_date_by_extension[ext][commit.date.to_date] = extensions_sums[ext]
end
end
@multi_data_file_counts_by_date ||= file_counts_by_date_by_extension.map { |ext, data|
{
name: ext || "NO EXTENSION",
data: data.fill_empty_days!(aggregated:true)
}
}
end

def lines_by_extension_by_date
lines_by_date_by_extension = {}
extensions_sums = {}
commits.map do |commit|
commit.lines_by_extension.map do |ext, count|
extensions_sums[ext] ||= 0;
extensions_sums[ext] = count;
lines_by_date_by_extension[ext] ||= {};
lines_by_date_by_extension[ext][commit.date.to_date] = extensions_sums[ext]
end
end
@multi_data_lines_by_date ||= lines_by_date_by_extension.map { |ext, data|
{
name: ext || "NO EXTENSION",
data: data.fill_empty_days!(aggregated:true)
}
}
end

def last_commit
commits.last
end
Expand Down Expand Up @@ -166,14 +124,9 @@ def project_name
end

def run(command)
if (command_memoization[command])
command_memoization[command]
else
result = command_runner.run(path, command)
invoke_command_observers(command, result)
command_memoization[command] = result
result
end
result = command_runner.run(path, command)
invoke_command_observers(command, result)
result
end

def run_and_parse(command)
Expand Down
2 changes: 1 addition & 1 deletion lib/git_stats/stats_view/charts/charts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module GitStats
module StatsView
module Charts
class All
delegate :files_by_extension, :files_by_extension_by_date, :lines_by_extension, :lines_by_extension_by_date, :files_by_date, :lines_by_date, :comments_by_date, to: :repo_charts
delegate :files_by_extension, :lines_by_extension, :files_by_date, :lines_by_date, :comments_by_date, to: :repo_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
Expand Down
20 changes: 0 additions & 20 deletions lib/git_stats/stats_view/charts/repo_charts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,6 @@ def lines_by_extension
end
end

def files_by_extension_by_date
Chart.new do |f|
f.multi_date_chart(
data: @repo.files_by_extension_by_date,
title: :files_by_extension_by_date.t,
y_text: :files.t
)
end
end

def lines_by_extension_by_date
Chart.new do |f|
f.multi_date_chart(
data: @repo.lines_by_extension_by_date,
title: :lines_by_extension_by_date.t,
y_text: :files.t
)
end
end

def files_by_date
Chart.new do |f|
f.date_chart(
Expand Down
4 changes: 0 additions & 4 deletions templates/files/_files.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
%a{:href => 'by_date.html'}= :files_by_date.t
%li{class: page == :files_by_extension ? "active" : ""}
%a{:href => 'by_extension.html'}= :files_by_extension.t
%li{class: page == :files_by_extension_by_date ? "active" : ""}
%a{:href => 'by_extension_by_date.html'}= :files_by_extension_by_date.t

.tab-content
.tab-pane.active
Expand All @@ -15,5 +13,3 @@
= high_stock("files_by_date", charts.files_by_date)
- elsif page == :files_by_extension
= high_chart("files_by_extension", charts.files_by_extension)
- elsif page == :files_by_extension_by_date
= high_stock("files_by_extension_by_date", charts.files_by_extension_by_date)
1 change: 0 additions & 1 deletion templates/files/by_extension_by_date.haml

This file was deleted.

4 changes: 0 additions & 4 deletions templates/lines/_lines.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
%a{:href => 'by_date.html'}= :lines_by_date.t
%li{class: page == :lines_by_extension ? "active" : ""}
%a{:href => 'by_extension.html'}= :lines_by_extension.t
%li{class: page == :lines_by_extension_by_date ? "active" : ""}
%a{:href => 'by_extension_by_date.html'}= :lines_by_extension_by_date.t

.tab-content
.tab-pane.active
Expand All @@ -15,5 +13,3 @@
= high_stock("lines_by_date", charts.lines_by_date)
- elsif page == :lines_by_extension
= high_chart("lines_by_extension", charts.lines_by_extension)
- elsif page == :lines_by_extension_by_date
= high_stock("lines_by_extension_by_date", charts.lines_by_extension_by_date)
1 change: 0 additions & 1 deletion templates/lines/by_extension_by_date.haml

This file was deleted.