<commit_before><commit_msg>apply discount to adjustment record<commit_after>Spree::Core::CalculatedAdjustments.class_eval do

  # UPGRADE_CHECK
  # Calculate the amount to be used when creating an adjustment
  # monkey patches https://github.com/spree/spree/blob/7d19c8933042cec667634c8cffedcbe6084abf1d/core/lib/spree/core/calculated_adjustments.rb#L45-L48
  def compute_amount(calculable)
    amount = self.calculator.compute(calculable)
    if self.is_a? Spree::ShippingMethod
      amount * (100 - (self.discount || 0 rescue 0))/100.0
    else
      amount
    end
  end

end
{'fraction_non_alphanumeric': 0.08981001727115717, 'fraction_numerical': 0.06044905008635579, 'mean_word_length': 4.420560747663552, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '930512', 'n_tokens_mistral': 226, 'n_tokens_neox': 197, 'n_words': 38}