lib/picky/query/weights.rb in picky-0.9.3 vs lib/picky/query/weights.rb in picky-0.9.4
- old
+ new
@@ -33,22 +33,19 @@
#
# ...
#
# Just kidding. It's far more complicated than that. Ha ha ha ha ;)
#
- include Helpers::Cache
+ # Note: Cache this if more complicated weighings become necessary.
+ #
def score combinations
- # TODO Rewrite to use the category
+ # TODO Beautify?
#
- categories = combinations.map { |combination| combination.bundle.category }.clustered_uniq
+ # weight_for combinations.map(&:category).clustered_uniq_fast.map!(&:name)
- # Note: Caching will not be necessary anymore if the
- # mapping is not necessary anymore.
+ # TODO combinations could cluster uniq as combinations are added (since combinations don't change).
#
- cached @weights_cache, categories do
- categories.map! &:name
- weight_for categories
- end
+ weight_for combinations.map(&:category_name).clustered_uniq_fast
end
-
+
end
end
\ No newline at end of file