<commit_before>$(function(){

  $('.tasks li input[type=checkbox]').on('change', function(e){
    var $this = $(this);
    var li = $this.closest('li');
    var url = $this.closest('form').attr('action');
    var completed = $this.is(':checked');

    // Do the work
    $.ajax({
        type: "put",
        url: url,
        data: {
          completed: completed
        }
    })
    .done(function(resp){
        if (resp.result) {
            if (resp.task.completed) li.addClass('complete');
            else li.removeClass('complete');
        }
    });
  });

});<commit_msg>update the number of incomplete tasks on change<commit_after>$(function(){

  $('.tasks li input[type=checkbox]').on('change', function(e){
    var $this = $(this);
    var li = $this.closest('li');
    var url = $this.closest('form').attr('action');
    var completed = $this.is(':checked');

    $.ajax({
        type: "put",
        url: url,
        data: {
          completed: completed
        }
    })
    .done(function(resp){
        if (resp.result) {
            if (resp.task.completed) li.addClass('complete');
            else li.removeClass('complete');

            count = li.closest('ul').find('li:not(.complete)').length
            li.closest('.tasks').find('h4').html(
                count + " Incomplete Task" + (count == 1 ? "" : "s")
            );
        }
    });
  });

});
{'fraction_non_alphanumeric': 0.19552669552669552, 'fraction_numerical': 0.001443001443001443, 'mean_word_length': 2.061810154525386, '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': '354906', 'n_tokens_mistral': 431, 'n_tokens_neox': 421, 'n_words': 85}