google_otg 1.0.16 → 1.0.17
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/google_otg.gemspec +2 -2
- data/lib/google_otg.rb +4 -4
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.17
|
data/google_otg.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{google_otg}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.17"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["esilverberg"]
|
12
|
-
s.date = %q{2009-
|
12
|
+
s.date = %q{2009-11-02}
|
13
13
|
s.description = %q{Include Google's Over Time Graph in your app}
|
14
14
|
s.email = %q{eric@ericsilverberg.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/google_otg.rb
CHANGED
@@ -4,7 +4,7 @@ require 'uri'
|
|
4
4
|
|
5
5
|
module GoogleOtg
|
6
6
|
|
7
|
-
DEFAULT_RANGE =
|
7
|
+
DEFAULT_RANGE = 1 # 1 day
|
8
8
|
|
9
9
|
def google_line_graph(hits, args = {})
|
10
10
|
|
@@ -237,7 +237,7 @@ eos
|
|
237
237
|
point_dates = []
|
238
238
|
|
239
239
|
now_days = tz.now # use this get the right year, month and day
|
240
|
-
now_minutes = tz.at((now_days.to_i/(60*range))*(60*range)).gmtime
|
240
|
+
now_minutes = tz.at((now_days.to_i/(60*(range * 1440)))*(60*(range * 1440))).gmtime
|
241
241
|
now_floored = tz.local(now_days.year, now_days.month, now_days.day,
|
242
242
|
now_minutes.hour, now_minutes.min, now_minutes.sec)
|
243
243
|
|
@@ -247,7 +247,7 @@ eos
|
|
247
247
|
current = hits.length > 0 ? time_fn.call(hits[0]) : now_floored
|
248
248
|
end
|
249
249
|
|
250
|
-
while (current < now_floored + range.
|
250
|
+
while (current < now_floored + range.days && range > 0) do
|
251
251
|
if hits_dict[current]
|
252
252
|
count = hits_dict[current].count.to_i
|
253
253
|
max_y = count if count > max_y
|
@@ -268,7 +268,7 @@ eos
|
|
268
268
|
end
|
269
269
|
# Save the date for the x labels later
|
270
270
|
point_dates.push({:key => date_key, :value => date_value})
|
271
|
-
current = current + range.
|
271
|
+
current = current + range.days
|
272
272
|
break if points.length > 100
|
273
273
|
end
|
274
274
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_otg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- esilverberg
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-02 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|