<commit_before>/**
 * Created by LeoAsp on 2016-05-11.
 */
$(document).ready(function () {
    var fbChosenTest = "";
    var fbChosenStudent = "";


    drawStudentList();

    function drawStudentList() {
        var users = JSON.parse(localStorage.getItem("users"));
        $("#studentNav").empty();
        for (var i = 0; i < users.mail.length; i++) {
            var $li = "";
            if (i % 2 == 0) {
                $li = $("<div class='grid-100 student gray' id='" + users.mail[i] + "'><div class='grid-33'>" + users.firstName[i] + "</div><div class='grid-33'>" + users.lastName[i] + "</div><div class='grid-33'>" + users.mail[i] + "</div></div>");
            } else {
                $li = $("<div class='grid-100 student white' id='" + users.mail[i] + "'><div class='grid-33'>" + users.firstName[i] + "</div><div class='grid-33'>" + users.lastName[i] + "</div><div class='grid-33'>" + users.mail[i] + "</div></div>");
            }
            $("#studentNav").append($li);
        }
    }

    $("#studentNav").on("click", ".student", function () {
        fbChosenStudent = $(this).attr('id');
        console.log("Clicked: " + fbChosenStudent);
        drawTestList();

    });

    function drawTestList() {
        $("#testNav").empty();
        console.log("Draw test list");
        var savedTests = JSON.parse(localStorage.getItem("savedtest"));
        var availableTests = new Array();
        var $div;

        for (var i = 0; i < savedTests.testName.length; i++) {
            console.log("for loop " + i);
            if (savedTests.studentmail[i] == fbChosenStudent) {
                console.log("found test for chosen student");
                if (savedTests.autoCorrect[i] == 0) {
                    console.log("found test not auto");
                    availableTests.push(i);
                    console.log("Test #: " + i + " " + savedTests.testName[i]);
                }
            }

        }

        for (var i = 0; i < availableTests.length; i++) {
            $div = $("<div class='grid-100 test' id='" + availableTests[i] + "'>" + savedTests.testName[availableTests[i]] + "</div>");
            $("#testNav").append($div);
        }

    }

    $("#testNav").on("click", ".test", function () {
        fbChosenTest = $(this).attr('id');
        drawStudentAnswers();

    });

    function drawStudentAnswers() {
        var savedTests = JSON.parse(localStorage.getItem("savedtest"));
        var $question="";
        for (var i = 0; i < savedTests.questionString[fbChosenTest].length; i++) {
            $question =
                "Fråga: " + savedTests.questionString[fbChosenTest][i] + "\n" +
                "Studentens svar: " + savedTests.studentAnswers[fbChosenTest][i] + "\n" +
                "Rätt svar: " + savedTests.correctAnswers[fbChosenTest][i] + "\n\n" +

                $("#txtResult").append($question);
        }
    }


    function emptyContent() {

    }
<commit_msg>fix#2<commit_after>/**
 * Created by LeoAsp on 2016-05-11.
 */
$(document).ready(function () {
    var fbChosenTest = "";
    var fbChosenStudent = "";


    drawStudentList();

    function drawStudentList() {
        var users = JSON.parse(localStorage.getItem("users"));
        $("#studentNav").empty();
        for (var i = 0; i < users.mail.length; i++) {
            var $li = "";
            if (i % 2 == 0) {
                $li = $("<div class='grid-100 student gray' id='" + users.mail[i] + "'><div class='grid-33'>" + users.firstName[i] + "</div><div class='grid-33'>" + users.lastName[i] + "</div><div class='grid-33'>" + users.mail[i] + "</div></div>");
            } else {
                $li = $("<div class='grid-100 student white' id='" + users.mail[i] + "'><div class='grid-33'>" + users.firstName[i] + "</div><div class='grid-33'>" + users.lastName[i] + "</div><div class='grid-33'>" + users.mail[i] + "</div></div>");
            }
            $("#studentNav").append($li);
        }
    }

    $("#studentNav").on("click", ".student", function () {
        fbChosenStudent = $(this).attr('id');
        console.log("Clicked: " + fbChosenStudent);
        drawTestList();

    });

    function drawTestList() {
        $("#testNav").empty();
        console.log("Draw test list");
        var savedTests = JSON.parse(localStorage.getItem("savedtest"));
        var availableTests = new Array();
        var $div;

        for (var i = 0; i < savedTests.testName.length; i++) {
            console.log("for loop " + i);
            if (savedTests.studentmail[i] == fbChosenStudent) {
                console.log("found test for chosen student");
                if (savedTests.autoCorrect[i] == 0) {
                    console.log("found test not auto");
                    availableTests.push(i);
                    console.log("Test #: " + i + " " + savedTests.testName[i]);
                }
            }

        }

        for (var i = 0; i < availableTests.length; i++) {
            $div = $("<div class='grid-100 test' id='" + availableTests[i] + "'>" + savedTests.testName[availableTests[i]] + "</div>");
            $("#testNav").append($div);
        }

    }

    $("#testNav").on("click", ".test", function () {
        fbChosenTest = $(this).attr('id');
        drawStudentAnswers();

    });

    function drawStudentAnswers() {
    $("#txtResult").empty();
        var savedTests = JSON.parse(localStorage.getItem("savedtest"));
        var $question="";
        for (var i = 0; i < savedTests.questionString[fbChosenTest].length; i++) {
            $question =
                "Fråga: " + savedTests.questionString[fbChosenTest][i] + "\n" +
                "Studentens svar: " + savedTests.studentAnswers[fbChosenTest][i] + "\n" +
                "Rätt svar: " + savedTests.correctAnswers[fbChosenTest][i] + "\n\n";

                $("#txtResult").append($question);
        }
    }


    function emptyContent() {

    }

{'fraction_non_alphanumeric': 0.19570365358592692, 'fraction_numerical': 0.012347767253044655, 'mean_word_length': 2.131885593220339, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 39, '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': '3129324', 'n_tokens_mistral': 1900, 'n_tokens_neox': 1792, 'n_words': 341}