<commit_before>"use strict";

angular.module("ehelseEditor").factory("StorageHandler", ["$rootScope", "FileUpload", "ServiceFunction", "CSVConverter",
    function ($rootScope, FileUpload, ServiceFunction, CSVConverter) {


        var input_list = [];

        init();

        function init() {
            input_list = FileUpload.getJsonFile();
            if (!input_list.documents) {
                input_list.documents = [];
            }
            if (!input_list.status) {
                input_list.status = [];
            }
            if (!input_list.mandatory) {
                input_list.mandatory = [];
            }
            if (!input_list.actions) {
                input_list.actions = [];
            }
            if (!input_list.documentTypes) {
                input_list.documentTypes = [];
            }
            if (!input_list.linkCategories) {
                input_list.linkCategories = [];
            }
            if (!input_list.documentFields) {
                input_list.documentFields = [];
            }
            if (!input_list.topics) {
                input_list.topics = [];
            }
            if (!input_list.archivedDocuments) {
                input_list.archivedDocuments = [];
            }
        }

        function initCsv() {
            input_list = CSVConverter.getConvertedCsv();
            if (!input_list.documents) {
                input_list.documents = [];
            }
            if (!input_list.status) {
                input_list.status = [];
            }
            if (!input_list.mandatory) {
                input_list.mandatory = [];
            }
            if (!input_list.actions) {
                input_list.actions = [];
            }
            if (!input_list.documentTypes) {
                input_list.documentTypes = [];
            }
            if (!input_list.linkCategories) {
                input_list.linkCategories = [];
            }
            if (!input_list.documentFields) {
                input_list.documentFields = [];
            }
            if (!input_list.topics) {
                input_list.topics = [];
            }
            if (!input_list.archivedDocuments) {
                input_list.archivedDocuments = [];
            }
            console.log(input_list.documents);

        }

        var SORT_ON_SEQUENCE = function (a, b) { // Constant for sequence sort (ascending)
            return a.sequence - b.sequence;
        };

        /**
         * Returns a clone of a multidimensional array
         * @param list
         */
        function cloneObjectList(list) {
            return (JSON.parse(JSON.stringify(list)));
        }

        /**<commit_msg>Fixed init value of document types<commit_after>"use strict";

angular.module("ehelseEditor").factory("StorageHandler", ["$rootScope", "FileUpload", "ServiceFunction", "CSVConverter",
    function ($rootScope, FileUpload, ServiceFunction, CSVConverter) {


        var input_list = [];

        init();

        function init() {
            input_list = FileUpload.getJsonFile();
            initValues();
        }

        function initCsv() {
            input_list = CSVConverter.getConvertedCsv();
            initValues();
        }

        function initValues(){
            input_list.documentTypes = [
                {
                    "id": "1",
                    "name": "Standard"
                },
                {
                    "id": "2",
                    "name": "Profil"
                },
                {
                    "id": "3",
                    "name": "Støttedokument"
                }
            ];
            if (!input_list.documents) {
                input_list.documents = [];
            }
            if (!input_list.status) {
                input_list.status = [];
            }
            if (!input_list.mandatory) {
                input_list.mandatory = [];
            }
            if (!input_list.actions) {
                input_list.actions = [];
            }
            if (!input_list.linkCategories) {
                input_list.linkCategories = [];
            }
            if (!input_list.documentFields) {
                input_list.documentFields = [];
            }
            if (!input_list.topics) {
                input_list.topics = [];
            }
            if (!input_list.archivedDocuments) {
                input_list.archivedDocuments = [];
            }
        }

        var SORT_ON_SEQUENCE = function (a, b) { // Constant for sequence sort (ascending)
            return a.sequence - b.sequence;
        };

        /**
         * Returns a clone of a multidimensional array
         * @param list
         */
        function cloneObjectList(list) {
            return (JSON.parse(JSON.stringify(list)));
        }

        /**
{'fraction_non_alphanumeric': 0.11350010336985734, 'fraction_numerical': 0.0006202191440975812, 'mean_word_length': 1.2618045815801777, 'pattern_counts': {'":': 6, '<': 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': '336969', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1191, 'n_words': 199}