<commit_before>$(document).ready(function() {

  $("#progress").on('submit', '.new_rating', function(event) {
    event.preventDefault();
    const $form = $(this),
          url = $form.attr('action'),
          method = $form.attr('method'),
          data = $form.serialize();

    $.ajax({
      url: url,
      method: method,
      data: data,
      dataType: "json"
    })
    .success(function(response) {
      $form.closest('.modal')[0].style.display = "none";
      // update score
      $form.closest('.collection-item').find('.current-score').text(response[0].score);
      // update goal partial
      $form.closest('.collection-item').find('.rating-partials-container')
        .prepend('<div class="rating-partial"><p class="confidence_score">Score: ' + response[0].score +
          '</p><p class="rating_comment">Comment: ' + response[0].comment + '</p></div>');
      // update progress bar
      $('.current-level').text(response[1]);
      $('.progress-bar').css("width:" + response[2] + "%");
    })
      .fail(function(error) {
      console.log(error);
    })
  });
});<commit_msg>Refactor rating jquery to clear rating form on submit<commit_after>$(document).ready(function() {

  $("#progress").on('submit', '.new_rating', function(event) {
    event.preventDefault();
    const $form = $(this),
          url = $form.attr('action'),
          method = $form.attr('method'),
          data = $form.serialize();

    $.ajax({
      url: url,
      method: method,
      data: data,
      dataType: "json"
    })
    .success(function(response) {
      $form.trigger('reset');
      $form.closest('.modal')[0].style.display = "none";
      // update score
      $form.closest('.collection-item').find('.current-score').text(response[0].score);
      // update goal partial
      $form.closest('.collection-item').find('.rating-partials-container')
        .prepend('<div class="rating-partial"><p class="confidence_score">Score: ' + response[0].score +
          '</p><p class="rating_comment">Comment: ' + response[0].comment + '</p></div>');
      // update progress bar
      $('.current-level').text(response[1]);
      $('.progress-bar').css("width:" + response[2] + "%");
    })
      .fail(function(error) {
      console.log(error);
    })
  });
});
{'fraction_non_alphanumeric': 0.21340929009640666, 'fraction_numerical': 0.0052585451358457495, 'mean_word_length': 2.8369747899159665, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '4212240', 'n_tokens_mistral': 686, 'n_tokens_neox': 684, 'n_words': 107}