<commit_before>
class RuleOnSale < Customization
  @feature_name = 'onsale'
  @product_type = ['BDepartments', 'FDepartments']
  @needed_features = [{CatSpec => 'saleEndDate'}, {ContSpec => 'salePrice'}, {ContSpec => 'regularPrice'}]
  @rule_type = 'Binary'
  
  def RuleOnSale.compute_feature(values, pid)
    date = values[0]
    rPrice = values[1]
    sPrice = values[2]
    if date == nil
      derived_value = false
    else
      derived_value = (Date.parse(val) - Date.today >= 0) && (rPrice > sPrice)
    end
    spec_class = Customization.rule_type_to_class(@rule_type)
    # if the value is false, we don't want to return (and store) a spec, we want to delete it, so do it here<commit_msg>fixed a typo in onSale rule<commit_after>
class RuleOnSale < Customization
  @feature_name = 'onsale'
  @product_type = ['BDepartments', 'FDepartments']
  @needed_features = [{CatSpec => 'saleEndDate'}, {ContSpec => 'price'}, {ContSpec => 'saleprice'}]
  @rule_type = 'Binary'
  
  def RuleOnSale.compute_feature(values, pid)
    date = values[0]
    rPrice = values[1]
    sPrice = values[2]
    if date == nil
      derived_value = false
    else
      derived_value = (Date.parse(date) - Date.today >= 0) && (rPrice > sPrice)
    end
    spec_class = Customization.rule_type_to_class(@rule_type)
    # if the value is false, we don't want to return (and store) a spec, we want to delete it, so do it here
{'fraction_non_alphanumeric': 0.1251778093883357, 'fraction_numerical': 0.005689900426742532, 'mean_word_length': 3.721476510067114, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, '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': '1671905', 'n_tokens_mistral': 488, 'n_tokens_neox': 472, 'n_words': 134}