Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def custom_value(promotion=nil)
- return nil if promotion.nil?
- if @promotion_custom_point_values.nil? or @current_promotion != promotion
- Rails.cache.fetch("custom_value_#{promotion.id}", :expires_in => 5.minutes, :race_condition_ttl => 10) do
- @promotion_custom_point_values = promotion.custom_point_values.reduce({}) do |hash, value|
- hash[value.action_id] = value if !hash.has_key?(value.action_id)
- hash
- end
- end
- end
- @current_promotion = promotion
- @promotion_custom_point_values[self.id]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement