g_ruby 0.0.6 → 0.0.7

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/g_ruby/analytics.rb +15 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b0302b7251b089963fdf92a27c93c96977e4b13
4
- data.tar.gz: 14779a226267e728f6edfbfbb22ebcba262866b9
3
+ metadata.gz: 9d4c66b33befa89ea4aa6b22cbae4d35cd82ed60
4
+ data.tar.gz: c451c48de3905e79524348668721aa9831d515ea
5
5
  SHA512:
6
- metadata.gz: e8854a5f5749d85bebcd74b7b5ae5aec19e95d4795bd87afd4375940c88d54fdf6bc0da1faafb99c7fb9beb1c47f9915addcdb2ef3aab6d7dc31292bbbe3d9f4
7
- data.tar.gz: cebf6444575b62da729051f3ed96a14d1344c1791b498e32860c84201a813cc12b908714c15fbaaf7d27219663a0621974e8e144dc84c5f0d3c329b2c5c6c3cf
6
+ metadata.gz: d7e884830ee87f0629bae61f619465170cc7026e9ed1098dd464f732944d949c77cde05b9d5419bb1dd87f595f4e7c1bf297368fbe1a34feeca0a3e2ee6bf855
7
+ data.tar.gz: f47a1947f327aeac4f81155170eb3f93fe7d158a41701cea7182d3db96f3671cc49a5e55521617e8dab1c9b64658389c40406fc25a92df29946df0d4ffa32194
@@ -119,7 +119,11 @@ class GRuby::Analytics
119
119
  d_this = a30[metric].to_i
120
120
  d_last = a60[metric].to_i
121
121
  dd = GRuby::Analytics.generate_delta_explaination(d_this, d_last, refresh)
122
- response_obj << {tag: metric.gsub("ga:", ""), val: a0[metric], delta: ((d_this - d_last) * 100 / d_last), delta_explaination: dd}
122
+ if d_last == 0
123
+ response_obj << {tag: metric.gsub("ga:", ""), val: a0[metric], delta: 0, delta_explaination: dd}
124
+ else
125
+ response_obj << {tag: metric.gsub("ga:", ""), val: a0[metric], delta: ((d_this - d_last) * 100 / d_last), delta_explaination: dd}
126
+ end
123
127
  end
124
128
  elsif dimensions.split(",").count == 1 and metrics.split(",").count == 1
125
129
  a0.each do |i|
@@ -132,7 +136,11 @@ class GRuby::Analytics
132
136
  d_last = k[1].to_i if k[0] == i[0]
133
137
  end
134
138
  dd = GRuby::Analytics.generate_delta_explaination(d_this, d_last, refresh)
135
- del = ((d_this.to_i - d_last.to_i) * 100 / d_last.to_f)
139
+ if d_last == 0
140
+ del = 0
141
+ else
142
+ del = ((d_this.to_i - d_last.to_i) * 100 / d_last.to_f)
143
+ end
136
144
  response_obj << {tag: metrics.gsub("ga:", ""), val: i[1], dimension: i[0], delta: del, delta_explaination: dd}
137
145
  end
138
146
  elsif dimensions.split(",").count > 1 and metrics.split(",").count == 1
@@ -151,7 +159,11 @@ class GRuby::Analytics
151
159
  d_last = k[2] if (k[0] == i[0] and k[1] == i[1])
152
160
  end
153
161
  dd = GRuby::Analytics.generate_delta_explaination(d_this, d_last, refresh)
154
- del = ((d_this.to_i - d_last.to_i) * 100 / d_last.to_f)
162
+ if d_last.to_f == 0
163
+ del = 0
164
+ else
165
+ del = ((d_this.to_i - d_last.to_i) * 100 / d_last.to_f)
166
+ end
155
167
  response_obj << {tag: i[0], val: i[2], dimension: k3, delta: del, delta_explaination: dd}
156
168
  end
157
169
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: g_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pykih Software