<commit_before>angular.module("controller")
    .controller("mainCtrl", ["$scope", "Storage", "Content", function ($scope, Storage, Content) {
        $scope.tab = 0;
        $scope.progress = 0;
        $scope.files = 0;

        $scope.setTab = function (item) {
            $scope.tab = item;
        };

        chrome.storage.sync.get("state", function (value) {
            $scope.status = value.state;

            if (value.state != undefined) {
                for (var i = 0; i < value.state.length; i++) {
                    if (!value.state.saved || value.state.saved == undefined) {
                        for (var j = 0; j < value.state[i].docs.length; j++) {
                            downloadFile(value.state[i].docs[j], value.state[i].source);
                        }

                        for (j = 0; j < value.state[i].video.length; j++) {
                            downloadFile(value.state[i].video[j], value.state[i].source);
                        }
                    }
                }
            }
        });

        $scope.avg = [];

        var onProgress = function (event) {
            if (event.lengthComputable) {
                var href = event.target.responseURL,
                    sum = 0,
                    isFound = false;

                for (item in $scope.avg) {
                    if ($scope.avg[item].name == href.split('/')[5]) {
                        $scope.avg[item].value = event.loaded / event.total;
                        isFound = true;
                    }
                }

                if (!isFound) {
                    $scope.avg.push({
                        name: href.split('/')[5],
                        value: event.loaded / event.total
                    });
                }

                for (item in $scope.avg) {
                    sum += $scope.avg[item].value;
                }

                $scope.progress = (sum / $scope.avg.length) / $scope.files;
                $scope.progress = Math.round($scope.progress * 100) / 100;

                $scope.$apply(function () {
                    $scope.progress = $scope.progress;
                });
            }
        };

        var downloadFile = function (file, directory) {
            $scope.files++;
            Content.download(file, function () {
                file.data = this.response;
                file = Storage.save(file, directory);
                $scope.files--;
            }, onProgress);
        }
    }]
);
<commit_msg>hot fix<commit_after>angular.module("controller")
    .controller("mainCtrl", ["$scope", "Storage", "Content", function ($scope, Storage, Content) {
        $scope.tab = 0;
        $scope.progress = 0;
        $scope.files = 0;

        $scope.setTab = function (item) {
            $scope.tab = item;
        };

        chrome.storage.sync.get("state", function (value) {
            $scope.status = value.state;

            if (value.state != undefined) {
                for (var i = 0; i < value.state.length; i++) {
                    for (var j = 0; j < value.state[i].docs.length; j++) {
                        downloadFile(value.state[i].docs[j], value.state[i].source);
                    }

                    for (j = 0; j < value.state[i].video.length; j++) {
                        downloadFile(value.state[i].video[j], value.state[i].source);
                    }
                }
            }
        });

        $scope.avg = [];

        var onProgress = function (event) {
            if (event.lengthComputable) {
                var href = event.target.responseURL,
                    sum = 0,
                    isFound = false;

                for (item in $scope.avg) {
                    if ($scope.avg[item].name == href.split('/')[5]) {
                        $scope.avg[item].value = event.loaded / event.total;
                        isFound = true;
                    }
                }

                if (!isFound) {
                    $scope.avg.push({
                        name: href.split('/')[5],
                        value: event.loaded / event.total
                    });
                }

                for (item in $scope.avg) {
                    sum += $scope.avg[item].value;
                }

                $scope.progress = (sum / $scope.avg.length) / $scope.files;
                $scope.progress = Math.round($scope.progress * 100) / 100;

                $scope.$apply(function () {
                    $scope.progress = $scope.progress;
                });
            }
        };

        var downloadFile = function (file, directory) {
            if (!file.saved || file.saved == undefined) {
                $scope.files++;
                Content.download(file, function () {
                    file.data = this.response;
                    file = Storage.save(file, directory);

                    chrome.storage.sync.clear();
                    chrome.storage.sync.set({state: $scope.status});
                    $scope.files--;
                }, onProgress);
            }
        }
    }]
);

{'fraction_non_alphanumeric': 0.13826240439301823, 'fraction_numerical': 0.0058835065699156695, 'mean_word_length': 1.0893076607947563, 'pattern_counts': {'":': 0, '<': 9, '<?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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1055346', 'n_tokens_mistral': 1407, 'n_tokens_neox': 1276, 'n_words': 248}