fnm-statistics 0.1.2 → 0.1.3
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/lib/statistics.rb +7 -2
- data/statistics.gemspec +2 -2
- metadata +17 -5
data/lib/statistics.rb
CHANGED
@@ -69,7 +69,12 @@ module Statistics
|
|
69
69
|
|
70
70
|
filters.each do |key, value|
|
71
71
|
if value
|
72
|
-
sql = ((@filter_all_on || {}).merge(scoped_options[:filter_on] || {}))
|
72
|
+
sql = ((@filter_all_on || {}).merge(scoped_options[:filter_on] || {}))
|
73
|
+
if value.is_a? Array # handle IN(?)
|
74
|
+
sql = sql[key].gsub("?", "#{value.join(', ')}")
|
75
|
+
else
|
76
|
+
sql = sql[key].gsub("?", "'#{value}'")
|
77
|
+
end
|
73
78
|
sql = sql.gsub("%t", "#{table_name}")
|
74
79
|
sql_frag = send(:sanitize_sql_for_conditions, sql)
|
75
80
|
case
|
@@ -89,7 +94,7 @@ module Statistics
|
|
89
94
|
|
90
95
|
base = base.send(scope[0], scope[1...scope.size])
|
91
96
|
end if scopes != [:all]
|
92
|
-
|
97
|
+
stat_value = base.send(calculation, scoped_options[:column_name], sql_options(scoped_options))
|
93
98
|
|
94
99
|
# cache stat value
|
95
100
|
Rails.cache.write("#{self.name}#{method_name}#{filters}", stat_value, :expires_in => options[:cache_for]) if options[:cache_for]
|
data/statistics.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fnm-statistics}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alexandru Catighera"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-05-27}
|
13
13
|
s.email = %q{acatighera@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.markdown"
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fnm-statistics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Alexandru Catighera
|
@@ -9,7 +15,7 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-05-27 00:00:00 +01:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
@@ -42,21 +48,27 @@ rdoc_options:
|
|
42
48
|
require_paths:
|
43
49
|
- lib
|
44
50
|
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
45
52
|
requirements:
|
46
53
|
- - ">="
|
47
54
|
- !ruby/object:Gem::Version
|
55
|
+
hash: 3
|
56
|
+
segments:
|
57
|
+
- 0
|
48
58
|
version: "0"
|
49
|
-
version:
|
50
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
51
61
|
requirements:
|
52
62
|
- - ">="
|
53
63
|
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
54
67
|
version: "0"
|
55
|
-
version:
|
56
68
|
requirements: []
|
57
69
|
|
58
70
|
rubyforge_project:
|
59
|
-
rubygems_version: 1.3.
|
71
|
+
rubygems_version: 1.3.7
|
60
72
|
signing_key:
|
61
73
|
specification_version: 3
|
62
74
|
summary: An ActiveRecord gem that makes it easier to do reporting.
|