<commit_before>$(document).ready(function(){
	var students = $('.student-row');

	$('.number-sort').on('click', function(event){
		event.preventDefault();
		var columnHead = $(this).find('.sort_link');
		var sortColumn = $(this).attr('id');
		if (columnHead.hasClass('sort-desc') == false){
			student_desc(students, sortColumn, columnHead);
		} else {
			student_asc(students, sortColumn, columnHead);
		}
	});

	$('.name-sort').on('click', function(event){
		event.preventDefault();
		var columnHead = $(this).find('.sort_link');
		var sortColumn = $(this).attr('id');
		if (columnHead.hasClass('sort-desc') == false){
			$('.sort-desc').removeClass('sort-desc');
			$('.sort-asc').removeClass('sort-asc');
			students = sort_asc(students, sortColumn);
			students.detach().appendTo('.table');
			columnHead.addClass("sort-desc");
		} else {
			$('.sort-desc').removeClass('sort-desc');
			$('.sort-asc').removeClass('sort-asc');
			students = sort_desc(students, sortColumn);
			students.detach().appendTo('.table');
			columnHead.addClass("sort-asc");
		}
	});

	function student_desc(students, sortColumn, columnHead){
		$('.sort-desc').removeClass('sort-desc');
		$('.sort-asc').removeClass('sort-asc');
		students = sort_desc(students, sortColumn);
		students.detach().appendTo('.table');
		columnHead.addClass("sort-desc");
	}

	function student_asc(students, sortColumn, columnHead){
		$('.sort-desc').removeClass('sort-desc');
		$('.sort-asc').removeClass('sort-asc');
		students = sort_asc(students, sortColumn);
		students.detach().appendTo('.table');
		columnHead.addClass("sort-asc");
	}

	function sort_desc(students, sortColumn){
		sorted = students.sort(function(a,b) {
			var c = $('#' + a.getAttribute('id') + ' .' + sortColumn).text(),
				d = $('#' + b.getAttribute('id') + ' .' + sortColumn).text();
			return sort(d,c);
		});
		return sorted
	}

	function sort_asc(students, sortColumn){
		sorted = students.sort(function(a,b) {
			var c = $('#' + a.getAttribute('id') + ' .' + sortColumn).text(),
				d = $('#' + b.getAttribute('id') + ' .' + sortColumn).text();
			return sort(c,d);
		});
		return sorted
	}

	function sort(item1, item2){
			if (parseInt(item1) && parseInt(item2)){ 
				item1 = +item1;
				item2 = +item2;
			};
		return item1 < item2 ? -1 : 1;
	};

});<commit_msg>Refactors additional functions.<commit_after>$(document).ready(function(){
	var students = $('.student-row');

	$('.number-sort').on('click', function(event){
		event.preventDefault();
		var columnHead = $(this).find('.sort_link');
		var sortColumn = $(this).attr('id');
		if (columnHead.hasClass('sort-desc') == false){
			kill_sort_classes();
			students = sort_desc(students, sortColumn);
			students.detach().appendTo('.table');
			add_desc(columnHead);
		} else {
			kill_sort_classes();
			students = sort_asc(students, sortColumn);
			add_asc(columnHead);
		}
	});

	$('.name-sort').on('click', function(event){
		event.preventDefault();
		var columnHead = $(this).find('.sort_link');
		var sortColumn = $(this).attr('id');
		if (columnHead.hasClass('sort-desc') == false){
			kill_sort_classes();
			students = sort_asc(students, sortColumn);
			add_desc(columnHead);
		} else {
			kill_sort_classes();
			students = sort_desc(students, sortColumn);
			add_asc(columnHead);
		}
	});

	function kill_sort_classes(){
		$('.sort-desc').removeClass('sort-desc');
		$('.sort-asc').removeClass('sort-asc');
	}

	function add_desc(columnHead){
		students.detach().appendTo('.table');
		columnHead.addClass("sort-desc");
	}

	function add_asc(columnHead){
		students.detach().appendTo('.table');
		columnHead.addClass("sort-asc");
	}

	function sort_desc(students, sortColumn){
		sorted = students.sort(function(a,b) {
			var c = $('#' + a.getAttribute('id') + ' .' + sortColumn).text(),
				d = $('#' + b.getAttribute('id') + ' .' + sortColumn).text();
			return sort(d,c);
		});
		return sorted
	}

	function sort_asc(students, sortColumn){
		sorted = students.sort(function(a,b) {
			var c = $('#' + a.getAttribute('id') + ' .' + sortColumn).text(),
				d = $('#' + b.getAttribute('id') + ' .' + sortColumn).text();
			return sort(c,d);
		});
		return sorted
	}

	function sort(item1, item2){
			if (parseInt(item1) && parseInt(item2)){ 
				item1 = +item1;
				item2 = +item2;
			};
		return item1 < item2 ? -1 : 1;
	};

});
{'fraction_non_alphanumeric': 0.21517527675276754, 'fraction_numerical': 0.005535055350553505, 'mean_word_length': 4.3477188655980274, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5815935', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1498, 'n_words': 231}