<commit_before>(function () {
    "use strict";

    function ContentSortController($scope, $timeout, contentResource) {

        var vm = this;
        var parentId = $scope.currentNode.parentId;

        vm.loading = false;
        vm.children = [];
        vm.saveButtonState = "init";
        vm.sortableOptions = {
            distance: 10,
            tolerance: "pointer",
            opacity: 0.7,
            scroll: true,
            cursor: "move",
            helper: fixSortableHelper
        };

        vm.save = save;

        function onInit() {
            vm.loading = true;
            contentResource.getChildren(parentId)
                .then(function(data){
                    vm.children = data.items;
                    vm.loading = false;
                });
        }

        function save() {
            vm.saveButtonState = "busy";
            
            var args = {
                parentId: parentId,
                sortedIds: _.map(vm.children, function(child){ return child.id; })
            };

            contentResource.sort(args).then(function(){
                vm.saveButtonState = "success";
            });
        }

        function fixSortableHelper(e, ui) {
            // keep the correct width of each table cell when sorting
            ui.children().each(function () {
                $(this).width($(this).width());
            });
            return ui;
        }

        onInit();
<commit_msg>get children from the current node id and not the parent<commit_after>(function () {
    "use strict";

    function ContentSortController($scope, $timeout, contentResource) {

        var vm = this;
        var id = $scope.currentNode.id;

        vm.loading = false;
        vm.children = [];
        vm.saveButtonState = "init";
        vm.sortableOptions = {
            distance: 10,
            tolerance: "pointer",
            opacity: 0.7,
            scroll: true,
            cursor: "move",
            helper: fixSortableHelper
        };

        vm.save = save;

        function onInit() {
            vm.loading = true;
            contentResource.getChildren(id)
                .then(function(data){
                    vm.children = data.items;
                    vm.loading = false;
                });
        }

        function save() {
            vm.saveButtonState = "busy";
            
            var args = {
                parentId: parentId,
                sortedIds: _.map(vm.children, function(child){ return child.id; })
            };

            contentResource.sort(args).then(function(){
                vm.saveButtonState = "success";
            });
        }

        function fixSortableHelper(e, ui) {
            // keep the correct width of each table cell when sorting
            ui.children().each(function () {
                $(this).width($(this).width());
            });
            return ui;
        }

        onInit();

{'fraction_non_alphanumeric': 0.11160258591357605, 'fraction_numerical': 0.0027220142905750254, 'mean_word_length': 1.3204419889502763, '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': '1794052', 'n_tokens_mistral': 764, 'n_tokens_neox': 725, 'n_words': 164}