Permalink
Browse files

bug in ratio with a negative numerator (v0.1.18)

  • Loading branch information...
1 parent a1bdcb9 commit 158b71fd2c49b54278586b093192b8d203dbb007 @PlasticLizard committed Apr 22, 2010
Showing with 8 additions and 5 deletions.
  1. +3 −0 CHANGELOG.rdoc
  2. +2 −2 cubicle.gemspec
  3. +2 −2 lib/cubicle/ratio.rb
  4. +1 −1 lib/cubicle/version.rb
View
3 CHANGELOG.rdoc
@@ -1,3 +1,6 @@
+==0.1.18
+ *Bug fixes
+
==0.1.16
*Added a set of default constants for expression templates, such as date_today, date_today_iso, date_today_utc_iso, etc.
Also added the 'define' method to the query DSL (instead of simply the aggregation DSL) so that you can either define new
View
4 cubicle.gemspec
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{cubicle}
- s.version = "0.1.17"
+ s.version = "0.1.18"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Nathan Stults"]
- s.date = %q{2010-04-19}
+ s.date = %q{2010-04-22}
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
4 lib/cubicle/ratio.rb
@@ -16,12 +16,12 @@ def finalize_aggregation(aggregation)
n = aggregation[numerator].to_f
d = aggregation[denominator].to_f
- #If the numerator is greater than zero, when we'll do the division
+ #If the numerator is not zero, when we'll do the division
#even if d is zero. This will result in a NaN, which indicates something
#wrong with the data, which is fine. However, if the numerator is zero,
#then maybe there just isn't any data, in which case NaN is pretty pessimistic -
#we'll return 0 instead in this case.
- aggregation[name] = n > 0 ? n/d : 0
+ aggregation[name] = n != 0 ? n/d : 0
end
def depends_on
View
2 lib/cubicle/version.rb
@@ -1,3 +1,3 @@
module Cubicle
- VERSION = '0.1.17'
+ VERSION = '0.1.18'
end

0 comments on commit 158b71f

Please sign in to comment.