git_stats 1.0.10 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 30553236ca6d0ffda730b03bd4afe80c35bf3659
4
- data.tar.gz: dcfeb19afb11a79756a8ffff27fafec2234ce9d2
3
+ metadata.gz: 9f3520a3ad6f9c046a9b1764cedcf337dfadd229
4
+ data.tar.gz: 8b48cb4ea3d79e15bc0bb2ecf67df7b67f5ed61a
5
5
  SHA512:
6
- metadata.gz: e9ea785447fb07f0739e1a8b7bae99d3ae09cbe7a8419b962033ebbbf902a46a954232d7ed949e6c903e8d2c50ae5d7722b7e01580fc7702a9001e9d1a4a14ce
7
- data.tar.gz: 07eef8bda388e73e4d07884b1d48d86c5a121f0e79aad72aa766090b3020b82fb09f92d6a56f1efcebd74f91e8bdb3219e25e1953c46fd589f80719b10e2ea1f
6
+ metadata.gz: 7decc1f75bd9778ddcb96d6c76c2751c92db8d7a88e04827ad7e4073476f2e2ac18b8136512253833160d837593994ed485e831da62ef3b32c5a329d348e2754
7
+ data.tar.gz: c31d7266352df2493e81d6a93ecb0f0a1785e281c708f170fe5843c0b2e9230ee259feb5a4383206ff56822040550e1c73c0226170e2eff4f5594b6fc17821ca
@@ -7,14 +7,16 @@ class Hash
7
7
  inject(Array.new(min_size, default)) { |acc, (k, v)| acc[k] = v; acc }.map { |e| e || default }
8
8
  end
9
9
 
10
- def fill_empty_days!(params = {:aggregated => false})
10
+ def fill_empty_days!(params = {:aggregated => true})
11
11
  return self if self.empty?
12
12
 
13
- days_with_data = self.keys.map(&:to_date).sort.uniq
13
+ self_with_date_keys = Hash[self.map { |k, v| [k.to_date, v] }]
14
+ days_with_data = self_with_date_keys.keys.sort.uniq
14
15
  prev = 0
16
+
15
17
  days_with_data.first.upto(days_with_data.last) do |day|
16
18
  if days_with_data.include? day
17
- prev = self[day]
19
+ prev = self_with_date_keys[day]
18
20
  else
19
21
  self[day] = params[:aggregated] ? prev : 0
20
22
  end
@@ -51,7 +51,7 @@ module GitStats
51
51
  def files_count_by_date
52
52
  @files_count_each_day ||= Hash[commits.map { |commit|
53
53
  [commit.date.to_date, commit.files_count]
54
- }].fill_empty_days!(aggregated: true)
54
+ }]
55
55
  end
56
56
 
57
57
  def lines_count_by_date
@@ -60,7 +60,7 @@ module GitStats
60
60
  sum += commit.short_stat.insertions
61
61
  sum -= commit.short_stat.deletions
62
62
  [commit.date.to_date, sum]
63
- }].fill_empty_days!(aggregated: true)
63
+ }]
64
64
  end
65
65
 
66
66
  def last_commit
@@ -48,7 +48,7 @@ module GitStats
48
48
 
49
49
  def date_column_chart(params)
50
50
  common_options(params)
51
- series(date_series(name: params[:title], data: params[:data]).merge(
51
+ series(date_series({name: params[:title], data: params[:data]}, false).merge(
52
52
  {
53
53
  type: 'column',
54
54
  dataGrouping: {units: [['day', [1]], ['week', [1]]], forced: true}
@@ -104,11 +104,11 @@ module GitStats
104
104
  x_text params[:x_text]
105
105
  end
106
106
 
107
- def date_series(params)
107
+ def date_series(params, aggregated = true)
108
108
  {
109
109
  name: params[:name],
110
110
  type: "spline",
111
- data: Hash[params[:data]].fill_empty_days!.map { |date, value| [date.to_datetime.to_i * 1000, value] }.sort_by { |d| d[0] }
111
+ data: Hash[params[:data]].fill_empty_days!(aggregated: aggregated).map { |date, value| [date.to_datetime.to_i * 1000, value] }.sort_by { |d| d[0] }
112
112
  }
113
113
  end
114
114
 
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module GitStats
3
- VERSION = "1.0.10"
3
+ VERSION = "1.0.11"
4
4
  end
@@ -3,6 +3,7 @@
3
3
  %html
4
4
  %head
5
5
  %title= "GitStats - #{repo.project_name}"
6
+ %meta{:charset => "utf-8"}
6
7
  %link{:rel => "stylesheet", :href => asset_path('bootstrap/css/bootstrap.min.css', active_page), :type => "text/css"}
7
8
  %style
8
9
  :plain
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Gieniusz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-12 00:00:00.000000000 Z
11
+ date: 2014-04-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport