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

  // Autocompletion sur le champs de recherche par nom
  $('#game_search_searchGame').autocomplete({
    source: function(request, response) {
            $.ajax({
              type: "POST",
              url: Routing.generate('display_games'),
              data: {
                  gameName: request.term
              },
              success: function(data){ response($.map
                        (jQuery.parseJSON(data['games']), function(i,v) {
                            return {
                            label: i.name ,
                            value: i.name
                };}));}

            });
        },


    });

    $("#game_sort_editeur").on('change', function() {
      console.log("data");

        sort(true);
    });
    $("#game_sort_trier_par").on('change', function() {
        sort(true);
    });
    $("#game_sort_age_min").on('change', function() {
        sort(true);
    });
    $("#game_sort_age_max").on('change', function() {
        sort(true);
    });
    $("#game_sort_duree").on('change', function() {
        sort(true);
    });
    $("#game_sort_categorie").on('change', function() {
        sort(true);
    });
    $("#game_sort_theme").on('change', function() {
        sort(true);
    });

    $("#game_sort_reinitialiser_les_filtres").on('click', function() {
        sort(false);
    });

    $("#game_search_Annuler").on('click', function() {
        sort(false);
    });

    function sort(sort){
      if(sort){
        var publishers = $("#game_sort_editeur").val();
        var ageMin=$("#game_sort_age_min").val();
        var ageMax=$("#game_sort_age_max").val();
        var orderby=$("#game_sort_trier_par").val();
        var duration=$("#game_sort_duree").val();
        var types=$("#game_sort_categorie").val();
        var themes=$("#game_sort_theme").val();

      }else{
        var publishers = "";
        var ageMin="";
        var ageMax="";
        var types="";
        var orderby="publication_asc";
        var duration="";
        var themes="";

      }


      $.ajax({
          type: "POST",
          url: Routing.generate('display_games'),
          data: {
              ageMin: ageMin,
              ageMax: ageMax,
              orderby: orderby,
              publishers: publishers,
              duration: duration,
              types: types,
              themes:themes
          },
          dataType: 'json',
          beforeSend: function(){
            $("#games-panel").html("");
             $("#loader").show();
           },
           complete: function(){
             $("#loader").hide();
           },
          success: function(data) {
            console.log(data);

            $("#games-panel").html(data);

          },
      });
    }

});
<commit_msg>Only on reset filters button<commit_after>$(document).ready(function() {

  // Autocompletion sur le champs de recherche par nom
  $('#game_search_searchGame').autocomplete({
    source: function(request, response) {
            $.ajax({
              type: "POST",
              url: Routing.generate('display_games'),
              data: {
                  gameName: request.term
              },
              success: function(data){ response($.map
                        (jQuery.parseJSON(data['games']), function(i,v) {
                            return {
                            label: i.name ,
                            value: i.name
                };}));}

            });
        },


    });

    $("#game_sort_editeur").on('change', function() {
      console.log("data");

        sort(true);
    });
    $("#game_sort_trier_par").on('change', function() {
        sort(true);
    });
    $("#game_sort_age_min").on('change', function() {
        sort(true);
    });
    $("#game_sort_age_max").on('change', function() {
        sort(true);
    });
    $("#game_sort_duree").on('change', function() {
        sort(true);
    });
    $("#game_sort_categorie").on('change', function() {
        sort(true);
    });
    $("#game_sort_theme").on('change', function() {
        sort(true);
    });

    $("#game_sort_reinitialiser_les_filtres").on('click', function() {
        sort(false);
    });

  

    function sort(sort){
      if(sort){
        var publishers = $("#game_sort_editeur").val();
        var ageMin=$("#game_sort_age_min").val();
        var ageMax=$("#game_sort_age_max").val();
        var orderby=$("#game_sort_trier_par").val();
        var duration=$("#game_sort_duree").val();
        var types=$("#game_sort_categorie").val();
        var themes=$("#game_sort_theme").val();

      }else{
        var publishers = "";
        var ageMin="";
        var ageMax="";
        var types="";
        var orderby="publication_asc";
        var duration="";
        var themes="";

      }


      $.ajax({
          type: "POST",
          url: Routing.generate('display_games'),
          data: {
              ageMin: ageMin,
              ageMax: ageMax,
              orderby: orderby,
              publishers: publishers,
              duration: duration,
              types: types,
              themes:themes
          },
          dataType: 'json',
          /*beforeSend: function(){
            $("#games-panel").html("");
             $("#loader").show();
           },
           complete: function(){
             $("#loader").hide();
           },*/
          success: function(data) {
            $("#games-panel").html(data);

          },
      });
    }

});

{'fraction_non_alphanumeric': 0.17649186256781194, 'fraction_numerical': 0.0, 'mean_word_length': 1.6706904876871076, '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': '4815318', 'n_tokens_mistral': 1580, 'n_tokens_neox': 1555, 'n_words': 248}