<commit_before>function pageViewModel(gvm) {
    // projecttitle
    gvm.projecttitle = ko.observable("");
    gvm.projectId = $("#projectHeader").data('value');
    gvm.studentId = $("#saveBtn").data('value');

    // Page specific i18n bindings
    gvm.title = ko.computed(function (){i18n.setLocale(gvm.lang()); return gvm.app() + ' - ' + i18n.__("ProjectTitle") + ": " + gvm.projecttitle();}, gvm);
    gvm.pageHeader = ko.observable("Project");
    gvm.projectname = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("ProjectName");}, gvm);
    gvm.menuLanguage = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("MenuLanguage");}, gvm);

    gvm.nameTableTitle = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("NameTableTitle");}, gvm);
    gvm.assessCompletementNumberToSubmit = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("AssessCompletementNumberToSubmit");}, gvm);
    gvm.projectWeight = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("ProjectWeight");}, gvm);
    gvm.assessCompletementNumberSubmitted = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("AssessCompletementNumberSubmitted");}, gvm);
    gvm.saveBtn = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("SaveBtn");}, gvm);
    gvm.cancelBtn = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("CancelBtn");}, gvm);
    gvm.documentScore = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("DocumentScore");}, gvm);
    gvm.documentSubmit = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("DocumentSubmit");}, gvm);

    gvm.getProjectInfo = function() {
        $.getJSON('/api/project/' + gvm.projectId, function(data) {
            gvm.pageHeader(data[0].code + ' - ' + data[0].name);
        });
    };

    gvm.documents = ko.observableArray([]);
    gvm.userData = ko.observableArray([]);

    gvm.addDocument = function(id,parentId, description, weight, pointType,score, nrDocuments, notSubmitted, nrNotSubmitted) {
        var doc = new Document(id,parentId,description,weight,pointType,score, nrDocuments, notSubmitted, nrNotSubmitted);
        gvm.documents.push(doc);
    };

    gvm.getAllData = function()
    {
        $.getJSON('/api/project/'+ gvm.projectId + '/documents/' + gvm.studentId, function(data) {
            $.each(data, function(i, item) {
                gvm.enterData(item);
                gvm.userData.push(item);
            });
        });
    };

    gvm.enterData = function(data)
    {
        gvm.documents().forEach(function(item) {
           if(data.document == item.parentId()) {
               item.id(data.id);
               item.score(data.score);
               item.notSubmitted(data.not_submitted);
               if (item.pointType() == "Ja/Nee") {
                   if (item.score() > 0) {
                       item.isChecked("yes");
                       item.score(100);
                   }
                   else {
                       item.isChecked("no");
                       item.score(0);
                   }
               }
           }
        });
        console.log(gvm.documents());
    };

    gvm.getDocumentsToSubmit = function() {
        $.getJSON('/api/project/'+ gvm.projectId + '/documents', function(data) {
            $.each(data, function(i, item) {
                var array = [];
                var numberArray = [];
                for(var i = 0; i <= item.nr_documents; i++)
                {
                    array.push(new AssessedDocument(0,0,0, item.point_type));
                    numberArray.push(i);
                }
                gvm.addDocument(0, item.id, item.description, item.weight, item.point_type, 0, array,0,numberArray);
            });
            gvm.getAllData();
        });
    };

    gvm.changeNotSubmitted = function(data,parent) {
        data.notSubmitted(parent);
        var len = data.nrNotSubmitted().length - data.notSubmitted() - 1;
        console.log(len);
        var point = data.pointType();
        data.nrDocuments([]);
        for(var i = 0; i < len; i++)
        {
            data.nrDocuments.push(0,0,0,point);
        }
    };

    gvm.clearStructure = function()
    {
        gvm.userData.destroyAll();
        gvm.documents.destroyAll();
    }
}

function AssessedDocument(id,parentId, score, pointType) {
    return {
        id: ko.observable(id),
        parentId: ko.observable(parentId),
        assessScore: ko.observable(score),
        pointType: ko.observable(pointType)
    }
}
<commit_msg>Grade documents<commit_after>function pageViewModel(gvm) {
    // projecttitle
    gvm.projecttitle = ko.observable("");
    gvm.projectId = $("#projectHeader").data('value');
    gvm.studentId = $("#saveBtn").data('value');

    // Page specific i18n bindings
    gvm.title = ko.computed(function (){i18n.setLocale(gvm.lang()); return gvm.app() + ' - ' + i18n.__("ProjectTitle") + ": " + gvm.projecttitle();}, gvm);
    gvm.pageHeader = ko.observable("Project");
    gvm.projectname = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("ProjectName");}, gvm);
    gvm.menuLanguage = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("MenuLanguage");}, gvm);

    gvm.nameTableTitle = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("NameTableTitle");}, gvm);
    gvm.assessCompletementNumberToSubmit = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("AssessCompletementNumberToSubmit");}, gvm);
    gvm.projectWeight = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("ProjectWeight");}, gvm);
    gvm.assessCompletementNumberSubmitted = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("AssessCompletementNumberSubmitted");}, gvm);
    gvm.saveBtn = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("SaveBtn");}, gvm);
    gvm.cancelBtn = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("CancelBtn");}, gvm);
    gvm.documentScore = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("DocumentScore");}, gvm);
    gvm.documentSubmit = ko.computed(function(){i18n.setLocale(gvm.lang()); return i18n.__("DocumentSubmit");}, gvm);

    gvm.getProjectInfo = function() {
        $.getJSON('/api/project/' + gvm.projectId, function(data) {
            gvm.pageHeader(data[0].code + ' - ' + data[0].name);
        });
    };

    gvm.documents = ko.observableArray([]);
    gvm.userData = ko.observableArray([]);

    gvm.addDocument = function(id,parentId, description, weight, pointType,score, nrDocuments, notSubmitted, nrNotSubmitted) {
        var doc = new Document(id,parentId,description,weight,pointType,score, nrDocuments, notSubmitted, nrNotSubmitted);
        gvm.documents.push(doc);
    };

    gvm.getAllData = function()
    {
        $.getJSON('/api/project/'+ gvm.projectId + '/documents/' + gvm.studentId, function(data) {
            $.each(data, function(i, item) {
                gvm.enterData(item);
                gvm.userData.push(item);
            });
        });
    };

    gvm.enterData = function(data)
    {
        gvm.documents().forEach(function(item) {
           if(data.document == item.parentId()) {
               item.id(data.id);
               item.score(data.score);
               item.notSubmitted(data.not_submitted);
               if (item.pointType() == "Ja/Nee") {
                   if (item.score() > 0) {
                       item.isChecked("yes");
                       item.score(100);
                   }
                   else {
                       item.isChecked("no");
                       item.score(0);
                   }
               }
           }
        });
        console.log(gvm.documents());
    };

    gvm.getDocumentsToSubmit = function() {
        $.getJSON('/api/project/'+ gvm.projectId + '/documents', function(data) {
            $.each(data, function(i, item) {
                var array = [];
                var numberArray = [];
                for(var i = 0; i <= item.nr_documents; i++)
                {
                    array.push(new AssessedDocument(0,0,0, item.point_type));
                    numberArray.push(i);
                }
                gvm.addDocument(0, item.id, item.description, item.weight, item.point_type, 0, array,0,numberArray);
            });
            gvm.getAllData();
        });
    };

    gvm.changeNotSubmitted = function(data,parent) {
        data.notSubmitted(parent);
        var len = data.nrNotSubmitted().length - data.notSubmitted() - 1;
        console.log(len);
        console.log(data);
        var point = data.pointType();
        data.nrDocuments([]);
        for(var i = 0; i < len; i++)
        {
            data.nrDocuments.push(0,0,0,point);
        }
    };

    gvm.clearStructure = function()
    {
        gvm.userData.destroyAll();
        gvm.documents.destroyAll();
    }
}

function AssessedDocument(id,parentId, score, pointType) {
    return {
        id: ko.observable(id),
        parentId: ko.observable(parentId),
        assessScore: ko.observable(score),
        pointType: ko.observable(pointType)
    }
}

{'fraction_non_alphanumeric': 0.16462688183688942, 'fraction_numerical': 0.014079930683418174, 'mean_word_length': 2.4225352112676055, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 5, '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': '106361', 'n_tokens_mistral': 3017, 'n_tokens_neox': 2849, 'n_words': 402}