daily pastebin goal
70%
SHARE
TWEET

Untitled

a guest Mar 10th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   def custom_value(promotion=nil)
  2.     return nil if promotion.nil?
  3.     if @promotion_custom_point_values.nil? or @current_promotion != promotion
  4.       Rails.cache.fetch("custom_value_#{promotion.id}", :expires_in => 5.minutes, :race_condition_ttl => 10) do
  5.         @promotion_custom_point_values = promotion.custom_point_values.reduce({}) do |hash, value|
  6.           hash[value.action_id] = value if !hash.has_key?(value.action_id)
  7.           hash
  8.         end
  9.       end
  10.     end
  11.     @current_promotion = promotion
  12.     @promotion_custom_point_values[self.id]
  13.   end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top