recommendations 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/recommendations/user.rb +1 -1
- data/lib/recommendations/version.rb +1 -1
- data/recommendations.gemspec +1 -1
- metadata +7 -9
- data/bin/console +0 -23
data/lib/recommendations/user.rb
CHANGED
@@ -12,6 +12,7 @@ module Recommendations
|
|
12
12
|
|
13
13
|
def recommendations
|
14
14
|
Recommendations.redis.hgetall("recommendations:user:#{id}")
|
15
|
+
.select {|key, value| Float(value) > 0}
|
15
16
|
end
|
16
17
|
|
17
18
|
def update_recommendations
|
@@ -33,4 +34,3 @@ module Recommendations
|
|
33
34
|
end
|
34
35
|
end
|
35
36
|
end
|
36
|
-
|
data/recommendations.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: recommendations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70216294291300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '2.10'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70216294291300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redis
|
27
|
-
requirement: &
|
27
|
+
requirement: &70216294290780 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,12 +32,11 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70216294290780
|
36
36
|
description: recommendations between similar items
|
37
37
|
email:
|
38
38
|
- victorc.rodrigues@gmail.com
|
39
|
-
executables:
|
40
|
-
- console
|
39
|
+
executables: []
|
41
40
|
extensions: []
|
42
41
|
extra_rdoc_files: []
|
43
42
|
files:
|
@@ -46,7 +45,6 @@ files:
|
|
46
45
|
- LICENSE
|
47
46
|
- README.md
|
48
47
|
- Rakefile
|
49
|
-
- bin/console
|
50
48
|
- lib/recommendations.rb
|
51
49
|
- lib/recommendations/configuration.rb
|
52
50
|
- lib/recommendations/item.rb
|
data/bin/console
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$:.push 'lib'
|
4
|
-
|
5
|
-
require "recommendations"
|
6
|
-
|
7
|
-
Recommendations.redis.flushdb
|
8
|
-
|
9
|
-
i1 = Recommendations::Item.new("1", violento: 100, romantico: 0, acao: 50)
|
10
|
-
i2 = Recommendations::Item.new("2", violento: 50, romantico: 0, acao: 50) # 1.50
|
11
|
-
i3 = Recommendations::Item.new("3", violento: 100, romantico: 100, acao: 0) # 1.150, 2.200
|
12
|
-
i4 = Recommendations::Item.new("4", violento: 70, romantico: 30, acao: 20) # 1.90, 2.80
|
13
|
-
|
14
|
-
items = [i1, i2, i3, i4]
|
15
|
-
|
16
|
-
items.each(&:save!)
|
17
|
-
|
18
|
-
items.each do |item|
|
19
|
-
item = Recommendations::Item.find(item.id)
|
20
|
-
puts "item: #{item.id}"
|
21
|
-
item.update_similars
|
22
|
-
puts "similars: #{item.similars}"
|
23
|
-
end
|