lib/disco/recommender.rb in disco-0.2.0 vs lib/disco/recommender.rb in disco-0.2.1
- old
+ new
@@ -85,10 +85,10 @@
if item_ids
idx = item_ids.map { |i| @item_map[i] }.compact
predictions.values_at(*idx)
else
- @rated[u].keys.each do |i|
+ @rated[u].keys.sort_by { |v| -v }.each do |i|
predictions.delete_at(i)
end
end
predictions.sort_by! { |pred| -pred[:score] } # already sorted by id