<commit_before>var DraggableStories = {

  draggable_left_offset: 33,

  init: function() {
    DraggableStories.label_columns();
    DraggableStories.create_container();
    
    // make droppables for each input box
    $('input[name="story[status]"]').each(DraggableStories.create_droppables);
  },

  // should be bound to a single radio button
  create_droppables: function() {
    var form = $(this).parents('form');
    var container = form.find('.draggables');
    var status = $(this).val();
    var id = this.id;

    container.append('<div class="'+status+'" id="droppable_' + this.id + '"></div>');

    var droppable = $('#droppable_' + id)
      .droppable({ 
        drop: function(ev, ui) { 
          var id_parts = id.split('_');
          var story_id = id_parts[id_parts.length - 1];

          // check the radio button
          $('li#story_'+story_id+' ol input').val([status]);

          // send the request
          form.ajaxSubmit();
          
          // change class of elements
          container.find('.ui-droppable').removeClass('ui-state-highlight');
          $(this).addClass('ui-state-highlight');
          $(ui.draggable)
          .css('left', 
               $(this).position().left + DraggableStories.draggable_left_offset);

          if (DraggableStories.previous_status == 'complete' || status == 'complete') {
            var location_parts = location.href.split('/');
            var iteration_id = location_parts[location_parts.length - 1];
            $('#burndown').attr('src',
                                '/iterations/' + iteration_id +
                                '/burndown?' + new Date().getTime());
          }

          DraggableStories.previous_status = status;
        }
      });

    // make a draggable if button is checked
    if ($(this).attr('checked')) {
      droppable_position = droppable.position();
      droppable.addClass('ui-state-highlight');

      container.append('<div id="draggable_' + this.id + '"></div>');

      $('#draggable_' + this.id)
        .draggable({ <commit_msg>update graph on ajax call success rather than immediately after sending ajax request<commit_after>var DraggableStories = {

  draggable_left_offset: 33,

  init: function() {
    DraggableStories.label_columns();
    DraggableStories.create_container();
    
    // make droppables for each input box
    $('input[name="story[status]"]').each(DraggableStories.create_droppables);
  },

  // should be bound to a single radio button
  create_droppables: function() {
    var form = $(this).parents('form');
    var container = form.find('.draggables');
    var status = $(this).val();
    var id = this.id;

    container.append('<div class="'+status+'" id="droppable_' + this.id + '"></div>');

    var droppable = $('#droppable_' + id)
      .droppable({ 
        drop: function(ev, ui) { 
          var id_parts = id.split('_');
          var story_id = id_parts[id_parts.length - 1];

          // check the radio button
          $('li#story_'+story_id+' ol input').val([status]);

          // send the request
          form.ajaxSubmit({
            success: function() {
              if (DraggableStories.previous_status == 'complete' || status == 'complete') {
                var location_parts = location.href.split('/');
                var iteration_id = location_parts[location_parts.length - 1];
                $('#burndown').attr('src',
                                    '/iterations/' + iteration_id +
                                    '/burndown?' + new Date().getTime());
              }

              DraggableStories.previous_status = status;
            }
          });
          
          // change class of elements
          container.find('.ui-droppable').removeClass('ui-state-highlight');
          $(this).addClass('ui-state-highlight');
          $(ui.draggable)
          .css('left', 
               $(this).position().left + DraggableStories.draggable_left_offset);
        }
      });

    // make a draggable if button is checked
    if ($(this).attr('checked')) {
      droppable_position = droppable.position();
      droppable.addClass('ui-state-highlight');

      container.append('<div id="draggable_' + this.id + '"></div>');

      $('#draggable_' + this.id)
        .draggable({ 
{'fraction_non_alphanumeric': 0.1524319292529672, 'fraction_numerical': 0.0018617640214102862, 'mean_word_length': 2.2002978406552494, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1443166', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1228, 'n_words': 248}