lib/picky/internals/query/weights.rb in picky-1.5.2 vs lib/picky/internals/query/weights.rb in picky-1.5.3
- old
+ new
@@ -5,20 +5,13 @@
class Weights # :nodoc:all
#
#
def initialize weights = {}
- # @weights_cache = {} # TODO
- @weights = prepare weights
+ @weights = weights
end
- # Get the category indexes for the given bonuses.
- #
- def prepare weights
- weights
- end
-
# Get the weight of an allocation.
#
def weight_for clustered
@weights[clustered] || 0
end
@@ -36,13 +29,11 @@
# Just kidding. It's far more complicated than that. Ha ha ha ha ;)
#
# Note: Cache this if more complicated weighings become necessary.
#
def score combinations
- # TODO Beautify? Use categories for weights?
+ # TODO Or hide: combinations#to_weights_key
#
- # weight_for combinations.map(&:category).clustered_uniq_fast.map!(&:name)
-
# TODO combinations could cluster uniq as combinations are added (since combinations don't change).
#
weight_for combinations.map(&:category_name).clustered_uniq_fast
end
\ No newline at end of file