twistage_stats_reports 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stats/breakdown_report.rb +4 -4
- data/lib/stats/event_report.rb +15 -0
- data/lib/stats/publish_report.rb +6 -6
- data/lib/stats/source_report.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96843d61c0c780f737a4c7c3ce988393280e776a
|
4
|
+
data.tar.gz: 36948d681790a554129f74230c7d0c05b3e958bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd27c7b461a3b8216faae98c2780bffd69d37bbd3652b23f1a57f351b754b36912d1a5b6e4c85e8341844306db91016d634e56b5dcc45f4db3243d9b7b85827c
|
7
|
+
data.tar.gz: 12badcab2c97c31f7cac569c1533490fc150841556fbc14011bff3bcad98c9c9e079c5f3fce1b5ff06a470b5a481fa4648f2eed0e082c62edbe82fef0aa30853
|
@@ -14,11 +14,11 @@ class Stats::BreakdownReport < Stats::EventReport
|
|
14
14
|
|
15
15
|
@query_time = nil
|
16
16
|
|
17
|
-
@duration_uploaded = (
|
18
|
-
@duration_uploaded_min = (
|
17
|
+
@duration_uploaded = self.class.format_duration(options[:duration_uploaded].to_f || 0)
|
18
|
+
@duration_uploaded_min = self.class.format_duration(@duration_uploaded / 60.seconds.to_f)
|
19
19
|
|
20
|
-
@duration_encoded = (
|
21
|
-
@duration_encoded_min = (
|
20
|
+
@duration_encoded = self.class.format_duration(options[:duration_encoded].to_f || 0)
|
21
|
+
@duration_encoded_min = self.class.format_duration(@duration_encoded / 60.seconds.to_f)
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.csv_keys
|
data/lib/stats/event_report.rb
CHANGED
@@ -19,6 +19,9 @@ class Stats::EventReport < Stats::Report
|
|
19
19
|
:bytes_transferred => %w[profile],
|
20
20
|
}
|
21
21
|
|
22
|
+
PRECISION_DURATION = 2
|
23
|
+
PRECISION_GB = 2
|
24
|
+
|
22
25
|
set_attributes [ :id, :date, :start_date, :end_date, :title, :label, :name, :query_time, :stats_type ]
|
23
26
|
set_numeric_attributes [ :hits, :plays, :downloads, :bytes_transferred]
|
24
27
|
|
@@ -340,6 +343,18 @@ class Stats::EventReport < Stats::Report
|
|
340
343
|
title_value
|
341
344
|
end
|
342
345
|
|
346
|
+
def self.format_float(value, precision)
|
347
|
+
value.round(precision)
|
348
|
+
end
|
349
|
+
|
350
|
+
def self.format_duration(value)
|
351
|
+
format_float(value, PRECISION_DURATION)
|
352
|
+
end
|
353
|
+
|
354
|
+
def self.format_gb(value)
|
355
|
+
format_float(value, PRECISION_GB)
|
356
|
+
end
|
357
|
+
|
343
358
|
private
|
344
359
|
|
345
360
|
def strip_keys_by_label(the_keys, label)
|
data/lib/stats/publish_report.rb
CHANGED
@@ -21,16 +21,16 @@ class Stats::PublishReport < Stats::EventReport
|
|
21
21
|
@query_time = nil
|
22
22
|
|
23
23
|
@bytes_uploaded = options[:bytes_uploaded]
|
24
|
-
@bytes_uploaded_gb = (
|
24
|
+
@bytes_uploaded_gb = self.class.format_gb(options[:bytes_uploaded] / 1.gigabyte.to_f)
|
25
25
|
|
26
26
|
@bytes_encoded = options[:bytes_encoded]
|
27
|
-
@bytes_encoded_gb = (
|
27
|
+
@bytes_encoded_gb = self.class.format_gb(options[:bytes_encoded] / 1.gigabyte.to_f)
|
28
28
|
|
29
|
-
@duration_uploaded = (
|
30
|
-
@duration_uploaded_min = (
|
29
|
+
@duration_uploaded = self.class.format_duration(options[:duration_uploaded])
|
30
|
+
@duration_uploaded_min = self.class.format_duration(options[:duration_uploaded] / 60.seconds.to_f)
|
31
31
|
|
32
|
-
@duration_encoded = (
|
33
|
-
@duration_encoded_min = (
|
32
|
+
@duration_encoded = self.class.format_duration(options[:duration_encoded])
|
33
|
+
@duration_encoded_min = self.class.format_duration(options[:duration_encoded] / 60.seconds.to_f)
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.csv_keys
|
data/lib/stats/source_report.rb
CHANGED
@@ -9,8 +9,8 @@ class Stats::SourceReport < Stats::EventReport
|
|
9
9
|
@publish_type = options[:publish_type]
|
10
10
|
@publishes = options[:publishes] || 0
|
11
11
|
@query_time = nil
|
12
|
-
@duration = (
|
13
|
-
@duration_min = (
|
12
|
+
@duration = self.class.format_duration(options[:duration] || 0)
|
13
|
+
@duration_min = self.class.format_duration(@duration / 60.seconds.to_f)
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.csv_keys
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twistage_stats_reports
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Wegman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Shared data structures and logic for interacting with the Twistage Stats
|
14
14
|
service
|