<commit_before>var FNBundle = Class.create({
  initialize: function(bundle_container) {
    this.bundle_container = bundle_container;
    
    // Initially disable the add button
    $(bundle_container).down('.add_button').disable();

    // Set up the keyup event for the bundle's input fields.
    this.boundBundleInputKeyUp = this.onBundleKeyUp.bind(this);
    $(bundle_container).select('.bundle input.quantity').each(function(input, index) {
      input.observe('keyup',this.boundBundleInputKeyUp);
    }.bind(this));
    
    // Set up the keyup event for the bundle_container's quantity input field.
    this.boundQuantityInputKeyUp = this.onQuantityKeyUp.bind(this);
    $(bundle_container).down('.product_add input.quantity').observe('keyup', this.boundQuantityInputKeyUp);
    
    // this.setTotalUnitsElement();
  },
  
  /**
   *  Handler for keyup events on the bundle input fields.
   */
  onBundleKeyUp: function(ev) {
    // First check that the field contains a number. If it doesn't abort.
    if(!this._isStringANumber(ev.target.getValue())) {
      ev.target.focus();
      return false;
    }

    this.setAddButton();
    
    // Reselect the input.
    ev.target.focus();
    
  },
    
  /**
   *  Handler for the keyup event on the product_add form's quantity input field.
   */
  onQuantityKeyUp: function(ev) {
    // First check that the field contains a number. If it doesn't abort.
    if(!this._isStringANumber(ev.target.getValue())) {
      ev.target.focus();
      return false;
    }  

    // Set the new totalUnit quantity.
    this.setTotalUnitsElement();<commit_msg>Fixed empty string bug in bundles.<commit_after>var FNBundle = Class.create({
  initialize: function(bundle_container) {
    this.bundle_container = bundle_container;
    
    // Initially disable the add button
    $(bundle_container).down('.add_button').disable();

    // Set up the keyup event for the bundle's input fields.
    this.boundBundleInputKeyUp = this.onBundleKeyUp.bind(this);
    $(bundle_container).select('.bundle input.quantity').each(function(input, index) {
      input.observe('keyup',this.boundBundleInputKeyUp);
    }.bind(this));
        
    // Set up the keyup event for the bundle_container's quantity input field.
    this.boundQuantityInputKeyUp = this.onQuantityKeyUp.bind(this);
    $(bundle_container).down('.product_add input.quantity').observe('keyup', this.boundQuantityInputKeyUp);
    
    // this.setTotalUnitsElement();
  },
  
  /**
   *  Handler for keyup events on the bundle input fields.
   */
  onBundleKeyUp: function(ev) {
    // First check that the field contains a number. If it doesn't abort.
    if(ev.target.getValue() != "" && !this._isStringANumber(ev.target.getValue())) {
      ev.target.focus();
      return false;
    }

    this.setAddButton();
    
    // Reselect the input.
    ev.target.focus();
    
  },
      
  /**
   *  Handler for the keyup event on the product_add form's quantity input field.
   */
  onQuantityKeyUp: function(ev) {
    // First check that the field contains a number. If it doesn't abort.
    if(!this._isStringANumber(ev.target.getValue())) {
      ev.target.focus();
      return false;
    }  

    // Set the new totalUnit quantity.
    this.setTotalUnitsElement();
{'fraction_non_alphanumeric': 0.12396694214876033, 'fraction_numerical': 0.0, 'mean_word_length': 3.0495662949194546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1753967', 'n_tokens_mistral': 989, 'n_tokens_neox': 953, 'n_words': 235}