<commit_before>/**
 *@author <NAME> <c13lbm>
 *@revision: <NAME> <dv13tes>
 */

var StudentList = React.createClass({

    submissions: null,
    participants: null,

    // This method is called after the method "render".
    componentDidMount: function () {
        var newTableObject = document.getElementById("students-table");
        console.log(1);
        sorttable.makeSortable(newTableObject);
        var table11_Props = {
            filters_row_index: 1,
            remember_grid_values: true
        };
        setFilterGrid("students-table", table11_Props);
    },

    // Method that is called when a user clicks on a submission (a table row).
    // It creates a new interface for submission grading..
    clickhandle: function (user, event) {
        window.studentName = user.firstName + " " + user.lastName;
        window.assignmentID = user.assignmentID;
        window.courseID = user.courseID;
        window.teacherID = user.teacherID;
        //TODO: REMOVE JEBANE
        document.getElementById("courseContent").innerHTML = ""; //TODO: find better solution.
        ReactDOM.render(<RenderHandle />, document.getElementById("courseContent"));
        //   this.getData();
        //TODO: render other user story.
    },

    getData: function () {

        var reqBody = {};

        reqBody["AssignmentID"] = window.assignmentID;
        reqBody["CourseID"] = window.courseID;
        reqBody["TeacherID"] = window.teacherID;
        reqBody["StudentID"] = window.studentID;

        $.ajax({
            type: "GET",
            contentType: "application/json",
            url: "https://localhost:8443/feedback/get",
            data: JSON.stringify(reqBody),
            timeout: 100000,
            success: function (response) {
                console.log("SUCCESS: ", response);
                // TODO: check response with if/else, if respons is fail give error message

            }, error: function (e) {
                console.log("ERROR: ", e);
                console.log(reqBody);
            }, done: function (e) {
                console.log("DONE");
            }
        });

    },

    componentWillMount: function () {

        this.submissions = this.props.submissions;
        this.participants = this.props.participants;
    },

    render: function () {
        var tmp = this;
        var userList = this.submissions.map(function (user) {
            var date = new Date(user.submissionDate);
            return (
                <tr onClick={tmp.clickhandle.bind(tmp,user)}>
                    <video width="96" height="54" class="clip-thumbnail"> <source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4"/> </video>
                    <td>{user.firstName + " " + user.lastName}</td>
                    <td>{date.getFullYear() + "-" + (date.getMonth()+1/*Months start from 0)*/ + "-" + date.getDate())}</td>
                    <td>{user.gradeSign}</td>
                </tr>
            );

            // console.log(tmp);
        });

            </tr>
        });
        return (
            <div className="row">
                <div className="four columns">
                    <table className="u-full-width sortable" id="students-table">
                        <thead>
                        <tr >

                            <th>Student</th>
                            <th>Date</th>
                            <th>Grade</th>
<commit_msg>Fixed weird merge<commit_after>/**
 *@author <NAME> <c13lbm>
 *@revision: <NAME> <dv13tes>
 */

var StudentList = React.createClass({

    submissions: null,
    participants: null,

    // This method is called after the method "render".
    componentDidMount: function () {
        var newTableObject = document.getElementById("students-table");
        console.log(1);
        sorttable.makeSortable(newTableObject);
        var table11_Props = {
            filters_row_index: 1,
            remember_grid_values: true
        };
        setFilterGrid("students-table", table11_Props);
    },

    // Method that is called when a user clicks on a submission (a table row).
    // It creates a new interface for submission grading..
    clickhandle: function (user, event) {
        window.studentName = user.firstName + " " + user.lastName;
        window.assignmentID = user.assignmentID;
        window.courseID = user.courseID;
        window.teacherID = user.teacherID;
        //TODO: REMOVE JEBANE
        document.getElementById("courseContent").innerHTML = ""; //TODO: find better solution.
        ReactDOM.render(<RenderHandle />, document.getElementById("courseContent"));
        //   this.getData();
        //TODO: render other user story.
    },

    getData: function () {

        var reqBody = {};

        reqBody["AssignmentID"] = window.assignmentID;
        reqBody["CourseID"] = window.courseID;
        reqBody["TeacherID"] = window.teacherID;
        reqBody["StudentID"] = window.studentID;

        $.ajax({
            type: "GET",
            contentType: "application/json",
            url: "https://localhost:8443/feedback/get",
            data: JSON.stringify(reqBody),
            timeout: 100000,
            success: function (response) {
                console.log("SUCCESS: ", response);
                // TODO: check response with if/else, if respons is fail give error message

            }, error: function (e) {
                console.log("ERROR: ", e);
                console.log(reqBody);
            }, done: function (e) {
                console.log("DONE");
            }
        });

    },

    componentWillMount: function () {

        this.submissions = this.props.submissions;
        this.participants = this.props.participants;
    },

    render: function () {
        var tmp = this;
        var userList = this.submissions.map(function (user) {
            var date = new Date(user.submissionDate);
            return (
                <tr onClick={tmp.clickhandle.bind(tmp,user)}>
                    <video width="96" height="54" class="clip-thumbnail"> <source src="http://techslides.com/demos/sample-videos/small.mp4" type="video/mp4"/> </video>
                    <td>{user.firstName + " " + user.lastName}</td>
                    <td>{date.getFullYear() + "-" + (date.getMonth()+1/*Months start from 0)*/ + "-" + date.getDate())}</td>
                    <td>{user.gradeSign}</td>
                </tr>
            );

            // console.log(tmp);

        });
        return (
            <div className="row">
                <div className="four columns">
                    <table className="u-full-width sortable" id="students-table">
                        <thead>
                        <tr >

                            <th>Student</th>
                            <th>Date</th>
                            <th>Grade</th>

{'fraction_non_alphanumeric': 0.13360560093348892, 'fraction_numerical': 0.008168028004667444, 'mean_word_length': 1.7671509281678772, 'pattern_counts': {'":': 0, '<': 58, '<?xml version=': 0, '>': 58, 'https://': 2, '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': '6030741', 'n_tokens_mistral': 1955, 'n_tokens_neox': 1842, 'n_words': 391}