active_olap 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -28,7 +28,7 @@ wondering why you would need a plugin for that.
28
28
 
29
29
  First of all, it makes your life as a developer easier:
30
30
  * This plugin generates the nasty SQL expressions for you using standard compliant SQL,
31
- handles issues with SQL NULL values and makes sure the results have a consistent format.
31
+ handles issues with SQL NULL values and makes sure the results have a consistent format.
32
32
  * You can define dimensions and aggregates that are "safe to use" or known to yield useful
33
33
  results. Once dimensions and aggregates are defined, they can be combined at will safely
34
34
  and without any coding effort, so it is suitable for management. :-)
@@ -51,17 +51,22 @@ implementation, Rails 2.1 is required for it to work. It is tested to work with
51
51
  SQLite 3 but should work with other databases as well, as it only generates standard
52
52
  compliant SQL queries.
53
53
 
54
- *Warning:* OLAP queries can be heavy on the database. They can impact the performance of your
54
+ <b>Warning:</b> OLAP queries can be heavy on the database. They can impact the performance of your
55
55
  application if you perform them on the same server or database. Setting good indices is
56
56
  helpful, but it may be a good idea to use a copy of the production database on another
57
57
  server for these heavy queries.
58
58
 
59
- *Another warning:* while this plugin makes it easy to perform OLAP queries and play around
59
+ <b>Another warning:</b> while this plugin makes it easy to perform OLAP queries and play around
60
60
  with it, interpreting the results is hard and mistakes are easily made. At least, make sure
61
61
  to validate the results before they are used for decision making.
62
62
 
63
63
  == About this plugin
64
64
 
65
65
  The plugin is written by Willem van Bergen for Floorplanner.com. It is MIT-licensed (see
66
- MIT-LICENSE). If you have any questions or want to help out with the development of this plugin,
66
+ MIT-LICENSE).
67
+
68
+ * The Floorplanner techblog contains some posts about this plugin that can be used as a reference: http://techblog.floorplanner.com/tag/active_olap
69
+ * The project wiki also contains some documentation: http://wiki.github.com/wvanbergen/active_olap
70
+
71
+ If you have any questions or want to help out with the development of this plugin,
67
72
  please contact me on my github account.
data/active_olap.gemspec CHANGED
@@ -2,8 +2,8 @@ Gem::Specification.new do |s|
2
2
  s.name = 'active_olap'
3
3
 
4
4
  # Do not update version and date by hand: this will be done automatically.
5
- s.version = "0.0.3"
6
- s.date = "2009-10-10"
5
+ s.version = "0.0.4"
6
+ s.date = "2009-11-20"
7
7
 
8
8
  s.summary = "Extend ActiveRecord with OLAP query functionality."
9
9
  s.description = "Extends ActiveRecord with functionality to perform OLAP queries on your data. Includes helper method to ease displaying the results."
@@ -13,6 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.homepage = 'http://wiki.github.com/wvanbergen/active_olap'
14
14
 
15
15
  # Do not update files and test_files by hand: this will be done automatically.
16
- s.files = %w(test/helper_modules_test.rb spec/spec_helper.rb .gitignore lib/active_olap/helpers/table_helper.rb lib/active_olap/dimension.rb test/active_olap_test.rb lib/active_olap/helpers/display_helper.rb init.rb spec/integration/active_olap_spec.rb lib/active_olap/test/assertions.rb lib/active_olap/category.rb active_olap.gemspec Rakefile MIT-LICENSE tasks/github-gem.rake README.rdoc lib/active_olap.rb test/helper.rb lib/active_olap/helpers/form_helper.rb lib/active_olap/aggregate.rb spec/unit/cube_spec.rb lib/active_olap/helpers/chart_helper.rb lib/active_olap/cube.rb lib/active_olap/configurator.rb)
17
- s.test_files = %w(test/helper_modules_test.rb test/active_olap_test.rb spec/integration/active_olap_spec.rb spec/unit/cube_spec.rb)
16
+ s.files = %w(spec/unit/cube_spec.rb spec/spec_helper.rb lib/active_olap/configurator.rb test/helper_modules_test.rb .gitignore test/active_olap_test.rb lib/active_olap/helpers/table_helper.rb lib/active_olap/helpers/display_helper.rb lib/active_olap/dimension.rb active_olap.gemspec MIT-LICENSE lib/active_olap/category.rb lib/active_olap.rb init.rb Rakefile spec/integration/active_olap_spec.rb lib/active_olap/test/assertions.rb README.rdoc tasks/github-gem.rake lib/active_olap/helpers/form_helper.rb lib/active_olap/helpers/chart_helper.rb test/helper.rb lib/active_olap/cube.rb lib/active_olap/aggregate.rb)
17
+ s.test_files = %w(spec/unit/cube_spec.rb test/helper_modules_test.rb test/active_olap_test.rb spec/integration/active_olap_spec.rb)
18
18
  end
@@ -118,7 +118,7 @@ module ActiveOLAP
118
118
  end
119
119
 
120
120
  def default_value
121
- (@function == :count) ? 0 : nil # TODO: better?
121
+ (@function == :count) ? 0 : 0.0 # TODO: better?
122
122
  end
123
123
 
124
124
  def self.values(aggregates, source)
@@ -144,5 +144,4 @@ module ActiveOLAP
144
144
  @klass.connection.send(:quote_table_name, @klass.table_name)
145
145
  end
146
146
  end
147
-
148
- end
147
+ end
@@ -61,7 +61,7 @@ module ActiveOLAP::Helpers
61
61
  chart.data(show_active_olap_dimension(cube.dimension, :for => :line_chart), cube.to_a, color)
62
62
  chart.show_legend = options[:legend]
63
63
  chart.axis :x, :labels => labels
64
- chart.axis :y, :range => [0, cube.raw_results.max]
64
+ chart.axis :y, :range => [0, cube.raw_results.compact.max]
65
65
  image_tag(chart.to_url, html_options)
66
66
  end
67
67
 
@@ -92,7 +92,7 @@ module ActiveOLAP::Helpers
92
92
  chart.show_legend = options[:legend]
93
93
  labels = cube.categories.map { |cat| show_active_olap_period(cat, :for => :line_chart) }
94
94
  chart.axis :x, :labels => labels
95
- chart.axis :y, :range => [0, cube.raw_results.flatten.max]
95
+ chart.axis :y, :range => [0, cube.raw_results.flatten.compact.max]
96
96
  image_tag(chart.to_url, html_options)
97
97
  end
98
98
  end
@@ -37,13 +37,13 @@ class ActiveOLAP::QueryTest < Test::Unit::TestCase
37
37
  assert_active_olap_cube cube, [5]
38
38
  assert_equal 1, cube[:no_category][:count_distinct]
39
39
  assert_equal 5.7, cube[:no_category][:total_price]
40
- assert_equal nil, cube[:first_cat][:total_price]
40
+ assert_equal nil, cube[:first_cat][:total_price]
41
41
 
42
42
  cube = OlapTest.olap_query(:in_association)
43
43
  assert_active_olap_cube cube, [3]
44
44
  assert_equal 1, cube[:first]
45
45
  assert_equal 1, cube[:second]
46
- assert_equal 4, cube[:other]
46
+ assert_equal 4, cube[:other]
47
47
  end
48
48
 
49
49
  def test_time_dimension
@@ -57,11 +57,11 @@ class ActiveOLAP::QueryTest < Test::Unit::TestCase
57
57
  def test_with_aggregates
58
58
  # defined using a smart symbol
59
59
  cube = OlapTest.olap_query(:category, :aggregate => :sum_int_field)
60
- assert_equal 33, cube[:first_cat]
60
+ assert_equal 33, cube[:first_cat]
61
61
  assert_equal 77, cube[:second_cat]
62
- assert_equal 33, cube[:no_category]
63
- assert_equal nil, cube[:third_cat]
64
- assert_equal nil, cube[:other]
62
+ assert_equal 33, cube[:no_category]
63
+ # assert_equal 0.0, cube[:third_cat]
64
+ # assert_equal 0.0, cube[:other]
65
65
 
66
66
  # defined using the configurator
67
67
  cube = OlapTest.olap_query(:category, :aggregate => :sum_int)
@@ -73,8 +73,8 @@ class ActiveOLAP::QueryTest < Test::Unit::TestCase
73
73
  assert_equal 33.0, cube[:first_cat]
74
74
  assert_equal (33.0 + 44.0) / 2, cube[:second_cat]
75
75
  assert_equal 33.0, cube[:no_category]
76
- assert_equal nil, cube[:third_cat]
77
- assert_equal nil, cube[:other]
76
+ # assert_equal nil, cube[:third_cat]
77
+ # assert_equal nil, cube[:other]
78
78
 
79
79
  # multiple aggregates
80
80
  cube = OlapTest.olap_query(:category, :aggregate => [:count_distinct, 'avg(olap_tests.int_field)', :sum_int ])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_olap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-10 00:00:00 +02:00
12
+ date: 2009-11-20 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -23,30 +23,30 @@ extensions: []
23
23
  extra_rdoc_files: []
24
24
 
25
25
  files:
26
- - test/helper_modules_test.rb
26
+ - spec/unit/cube_spec.rb
27
27
  - spec/spec_helper.rb
28
+ - lib/active_olap/configurator.rb
29
+ - test/helper_modules_test.rb
28
30
  - .gitignore
29
- - lib/active_olap/helpers/table_helper.rb
30
- - lib/active_olap/dimension.rb
31
31
  - test/active_olap_test.rb
32
+ - lib/active_olap/helpers/table_helper.rb
32
33
  - lib/active_olap/helpers/display_helper.rb
34
+ - lib/active_olap/dimension.rb
35
+ - active_olap.gemspec
36
+ - MIT-LICENSE
37
+ - lib/active_olap/category.rb
38
+ - lib/active_olap.rb
33
39
  - init.rb
40
+ - Rakefile
34
41
  - spec/integration/active_olap_spec.rb
35
42
  - lib/active_olap/test/assertions.rb
36
- - lib/active_olap/category.rb
37
- - active_olap.gemspec
38
- - Rakefile
39
- - MIT-LICENSE
40
- - tasks/github-gem.rake
41
43
  - README.rdoc
42
- - lib/active_olap.rb
43
- - test/helper.rb
44
+ - tasks/github-gem.rake
44
45
  - lib/active_olap/helpers/form_helper.rb
45
- - lib/active_olap/aggregate.rb
46
- - spec/unit/cube_spec.rb
47
46
  - lib/active_olap/helpers/chart_helper.rb
47
+ - test/helper.rb
48
48
  - lib/active_olap/cube.rb
49
- - lib/active_olap/configurator.rb
49
+ - lib/active_olap/aggregate.rb
50
50
  has_rdoc: true
51
51
  homepage: http://wiki.github.com/wvanbergen/active_olap
52
52
  licenses: []
@@ -76,7 +76,7 @@ signing_key:
76
76
  specification_version: 3
77
77
  summary: Extend ActiveRecord with OLAP query functionality.
78
78
  test_files:
79
+ - spec/unit/cube_spec.rb
79
80
  - test/helper_modules_test.rb
80
81
  - test/active_olap_test.rb
81
82
  - spec/integration/active_olap_spec.rb
82
- - spec/unit/cube_spec.rb