Skip to content
Browse files

Bump version to 2.0.1

Signed-off-by: David Celis <david@davidcelis.com>
  • Loading branch information...
1 parent c8efb83 commit 63ddb811746c4039b9d16cfcfa0d09207fce7c53 @davidcelis committed Oct 24, 2012
Showing with 19 additions and 3 deletions.
  1. +6 −2 CHANGELOG.md
  2. +13 −1 test/recommendable/helpers/calculations_test.rb
View
8 CHANGELOG.md
@@ -1,8 +1,12 @@
Changelog
=========
-2.0.0.20121011 (Current version)
---------------------------------
+2.0.1 (Current version)
+-----------------------
+* Fix a bug that caused recommendations always to calculate as 0.0
+
+2.0.0.20121011
+--------------
* Fix a bug where rated items would show up in recommended sets
* Fix support for versions of Redis < 2.4. Redis 1.x is untested.
* Fix a bug where workers would not queue up jobs.
View
14 test/recommendable/helpers/calculations_test.rb
@@ -13,7 +13,7 @@ def setup
# @user.similarity_with(@user1) should == 1.0
[@movie1, @movie2, @movie3, @book4, @book5, @book6, @book7, @book8, @movie9, @movie10].each { |obj| @user1.like(obj) }
- [@book1, @book2, @book3, @movie4, @movie5, @movie6, @movie8, @movie8, @book9, @book10].each { |obj| @user1.dislike(obj) }
+ [@book1, @book2, @book3, @movie4, @movie5, @movie6, @movie7, @movie8, @book9, @book10].each { |obj| @user1.dislike(obj) }
# @user.similarity_with(@user2) should == 0.25
[@movie1, @movie2, @movie3, @book4, @book5, @book6].each { |obj| @user2.like(obj) }
@@ -51,6 +51,18 @@ def test_update_recommendations_ignores_rated_items
books.each { |b| refute_includes @user.recommended_books, b }
end
+ def test_predict_for_returns_predictions
+ Recommendable::Helpers::Calculations.update_similarities_for(@user.id)
+ assert_equal Recommendable::Helpers::Calculations.predict_for(@user.id, @book7.class, @book7.id), 1.0
+ assert_equal Recommendable::Helpers::Calculations.predict_for(@user.id, @book8.class, @book8.id), 1.0
+ assert_equal Recommendable::Helpers::Calculations.predict_for(@user.id, @book9.class, @book9.id), -1.0
+ assert_equal Recommendable::Helpers::Calculations.predict_for(@user.id, @book10.class, @book10.id), -1.0
+ assert_equal Recommendable::Helpers::Calculations.predict_for(@user.id, @movie7.class, @movie7.id), -1.0
+ assert_equal Recommendable::Helpers::Calculations.predict_for(@user.id, @movie8.class, @movie8.id), -1.0
+ assert_equal Recommendable::Helpers::Calculations.predict_for(@user.id, @movie9.class, @movie9.id), 1.0
+ assert_equal Recommendable::Helpers::Calculations.predict_for(@user.id, @movie10.class, @movie10.id), 1.0
+ end
+
def teardown
Recommendable.redis.flushdb
end

0 comments on commit 63ddb81

Please sign in to comment.
Something went wrong with that request. Please try again.