google_otg 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.
- data/VERSION +1 -1
- data/google_otg.gemspec +1 -1
- data/lib/google_otg.rb +7 -6
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.11
|
data/google_otg.gemspec
CHANGED
data/lib/google_otg.rb
CHANGED
@@ -205,9 +205,10 @@ eos
|
|
205
205
|
}
|
206
206
|
|
207
207
|
tz = args.has_key?(:time_zone) ? args[:time_zone] : ActiveSupport::TimeZone['UTC']
|
208
|
-
Time.zone = tz
|
209
208
|
label = args.has_key?(:label) ? args[:label] : "Value"
|
210
|
-
time_fn = args.has_key?(:time_fn) ? args[:time_fn] : lambda {|h|
|
209
|
+
time_fn = args.has_key?(:time_fn) ? args[:time_fn] : lambda {|h|
|
210
|
+
return tz.local(h.created_at.year, h.created_at.month, h.created_at.day, h.created_at.hour, h.created_at.min, h.created_at.sec) # create zoned time
|
211
|
+
}
|
211
212
|
range = args.has_key?(:range) ? args[:range] : DEFAULT_RANGE
|
212
213
|
x_label_format = args.has_key?(:x_label_format) ? args[:x_label_format] : "%A %I:%M%p"
|
213
214
|
|
@@ -222,9 +223,9 @@ eos
|
|
222
223
|
points = []
|
223
224
|
point_dates = []
|
224
225
|
|
225
|
-
now_days =
|
226
|
-
now_minutes =
|
227
|
-
now_floored =
|
226
|
+
now_days = tz.now # use this get the right year, month and day
|
227
|
+
now_minutes = tz.at((now_days.to_i/(60*range))*(60*range)).gmtime
|
228
|
+
now_floored = tz.local(now_days.year, now_days.month, now_days.day,
|
228
229
|
now_minutes.hour, now_minutes.min, now_minutes.sec)
|
229
230
|
|
230
231
|
current = hits.length > 0 ? time_fn.call(hits[0]) : now_floored
|
@@ -267,7 +268,7 @@ eos
|
|
267
268
|
max_x_label_count = args.has_key?(:max_x_label_count) ? args[:max_x_label_count] : points.length
|
268
269
|
|
269
270
|
if points.length > 0
|
270
|
-
step = points.length / max_x_label_count
|
271
|
+
step = [points.length / max_x_label_count, 1].max
|
271
272
|
idx = 0
|
272
273
|
|
273
274
|
while idx < points.length
|