Permalink
Browse files

==0.1.19

   *Fixed bug that caused cubicle to hang when grouping by days
  • Loading branch information...
1 parent 480fdd8 commit bde1648cf744feaaea73a3580190716b14cb191f @PlasticLizard committed Apr 28, 2010
Showing with 28 additions and 2 deletions.
  1. +3 −0 CHANGELOG.rdoc
  2. +2 −2 cubicle.gemspec
  3. +10 −0 lib/cubicle/support.rb
  4. +13 −0 test/cubicle/cubicle_query_test.rb
View
@@ -1,3 +1,6 @@
+==0.1.19
+ *Fixed bug that caused cubicle to hang when grouping by days
+
==0.1.18
*Bug fixes
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{cubicle}
- s.version = "0.1.18"
+ s.version = "0.1.19"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Nathan Stults"]
- s.date = %q{2010-04-22}
+ s.date = %q{2010-04-28}
s.description = %q{Cubicle provides a dsl and aggregation caching framework for automating the generation, execution and caching of map reduce queries when using MongoDB in Ruby. Cubicle also includes a MongoMapper plugin for quickly performing ad-hoc, multi-level group-by queries against a MongoMapper model.}
s.email = %q{hereiam@sonic.net}
s.extra_rdoc_files = [
View
@@ -12,6 +12,11 @@ def step_by=(by)
end
def succ
+ self.step_by = :day if step_by.to_sym == :date
+ valid_steps = [:second,:minute,:hour,:week,:day,:month,:year]
+ valid_steps += valid_steps.map{|s|s.to_s.pluralize.to_sym}
+ raise "Invalid 'step_by' speficication. Was #{step_by} but must be one of #{valid_steps.inspect}" unless valid_steps.include?(step_by.to_sym)
+
next_date = advance(step_by.to_s.pluralize.to_sym=>1)
next_date.step_by = self.step_by
next_date
@@ -32,6 +37,11 @@ def step_by=(by)
end
def succ
+ step_by = :day if step_by.to_sym == :date
+ valid_steps = [:second,:minute,:hour,:week,:days,:month,:year]
+ valid_steps += valid_steps.map{|s|s.to_s.pluralize.to_sym}
+ raise "Invalid 'step_by' speficication. Was #{step_by} but must be one of #{valid_steps.inspect}" unless valid_steps.include?(step_by.to_sym)
+
next_date = advance(step_by.to_s.pluralize.to_sym=>1)
next_date.step_by = self.step_by
next_date
@@ -467,5 +467,18 @@ class CubicleQueryTest < ActiveSupport::TestCase
assert_equal 0, results[1].defects_this_year
end
end
+ context "Grouping by day" do
+ should "not cause the system to hang" do
+ Time.now = "2010-01-01"
+ results = DefectCubicle.query do
+ select :defects_this_year
+ by :date
+ for_the_last 5.days
+ end
+ puts results.inspect
+ assert_not_nil results
+ end
+
+ end
end
end

0 comments on commit bde1648

Please sign in to comment.