mochigome 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/lib/mochigome_ver.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mochigome
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/query.rb CHANGED
@@ -72,7 +72,7 @@ module Mochigome
72
72
  d_cols.each_with_index do |col, i|
73
73
  d_rel.project(col.as("g#{i}")).group(col)
74
74
  end
75
- d_rel.where(cond)
75
+ d_rel.where(cond) if cond
76
76
 
77
77
  a_rel = Arel::SelectManager.new(
78
78
  Arel::Table.engine,
@@ -207,6 +207,24 @@ describe Mochigome::Query do
207
207
  assert_equal 24, data_node['Sales count']
208
208
  end
209
209
 
210
+ it "collects aggregate data on layers above the focus when given no condition" do
211
+ q = Mochigome::Query.new(
212
+ [Owner, Store, Product],
213
+ :aggregate_sources => [[Product, Sale]]
214
+ )
215
+
216
+ tbl = Arel::Table.new(Owner.table_name)
217
+ data_node = q.run
218
+
219
+ assert_equal "Jane's Store (North)", (data_node/1/0).name
220
+ assert_equal 11, (data_node/1/0)['Sales count']
221
+
222
+ assert_equal "Jane Doe", (data_node/1).name
223
+ assert_equal 16, (data_node/1)['Sales count']
224
+
225
+ assert_equal 24, data_node['Sales count']
226
+ end
227
+
210
228
  it "can do conditional counts" do
211
229
  q = Mochigome::Query.new(
212
230
  [Category],
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mochigome
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Mike Simon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-03-02 00:00:00 Z
18
+ date: 2012-03-03 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement