<commit_before>

uwdoem.sort = (function() {
    
    var setupSortFilter = function (handle) {
        var filterSection = $("div.sort-container[data-handle-for=" + handle + "]").parents('.ajax-loaded-section');
        var filterSectionName=filterSection.data('section-name');

        var headers = filterSection.find("th");
        headers.addClass("clickable");
        headers.removeClass("sorted ascending descending");

        var fieldname = uwdoem.ajax_section.getGetVar(filterSectionName, 'sort', 'fieldname');
        var order = uwdoem.ajax_section.getGetVar(filterSectionName, 'sort', 'order');
        filterSection.find("th[data-header-for='" + fieldname + "']").addClass("sorted " + order);

        headers.click(function() {
            var fieldname = $(this).attr("data-header-for");
            uwdoem.ajax_section.registerGetVar(filterSectionName, 'sort', 'fieldname', fieldname);

            var oldOrder = uwdoem.ajax_section.getGetVar(filterSectionName, 'sort', 'order');
            var oldFieldname = uwdoem.ajax_section.getGetVar(filterSectionName, 'sort', 'fieldname');

            var newOrder = "ascending";
            if (fieldname === oldFieldname && oldOrder === "ascending") {
                newOrder = "ascending";
            }
            uwdoem.ajax_section.registerGetVar(filterSectionName, 'sort', 'order', newOrder);
            uwdoem.ajax_section.loadSection(filterSectionName);
        });
    };

    return {
        setupSortFilter: setupSortFilter
    };
}());<commit_msg>Fix sort.js.<commit_after>

uwdoem.sort = (function() {
    
    var setupSortFilter = function (handle) {
        var filterSection = $("div.sort-container[data-handle-for=" + handle + "]").parents('.ajax-loaded-section');
        var filterSectionName = filterSection.data('section-name');
        var ajaxSectionName = filterSection.closest("div.ajax-loaded-section").attr("id");

        var headers = filterSection.find("th");
        headers.addClass("clickable");
        headers.removeClass("sorted ascending descending");

        var fieldname = uwdoem.ajax_section.getGetVarValue(ajaxSectionName, handle, 'fieldname');
        var order = uwdoem.ajax_section.getGetVarValue(ajaxSectionName, handle, 'order');
        filterSection.find("th[data-header-for='" + fieldname + "']").addClass("sorted " + order);

        headers.click(function() {
            var fieldname = $(this).attr("data-header-for");

            var oldOrder = uwdoem.ajax_section.getGetVarValue(ajaxSectionName, handle, 'order');
            var oldFieldname = uwdoem.ajax_section.getGetVarValue(ajaxSectionName, handle, 'fieldname');

            var newOrder = "ascending";
            if (fieldname === oldFieldname && oldOrder === "ascending") {
                newOrder = "descending";
            }

            uwdoem.ajax_section.registerGetVar(uwdoem.ajax_section.getVar(ajaxSectionName, handle, 'fieldname', fieldname));
            uwdoem.ajax_section.registerGetVar(uwdoem.ajax_section.getVar(ajaxSectionName, handle, 'order', newOrder));

            uwdoem.ajax_section.loadSection(ajaxSectionName);
        });
    };

    return {
        setupSortFilter: setupSortFilter
    };
}());
{'fraction_non_alphanumeric': 0.14045468701339148, 'fraction_numerical': 0.0, 'mean_word_length': 3.112676056338028, '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': '869253', 'n_tokens_mistral': 920, 'n_tokens_neox': 908, 'n_words': 147}