<commit_before>import React from 'react';
import { withRouter } from 'react-router';
import { fetchSubmissions } from '../ContestActions.js';
import ReactTable from 'react-table';
import './judgesubmissionpage.css';
import ChatSideBar from '../components/ChatSideBar';

class JudgeSubmissionsPage extends React.Component {

    constructor(props) {
        super(props);
        this.state = {};
        this.columns = [{
            header: 'Team',
            accessor: 'teamName',
        }, {
            header: 'Problem',
            accessor: 'problemName',
        }, {
            header: 'Feedback',
            accessor: 'feedback',
        }, {
            header: 'Submission Time',
            accessor: 'submissionTime',
        }, {
            header: 'Time since contest started',
            accessor: 'timeSinceContestStarted',
        }];
    }

    componentDidMount() {
        const intervalFunc = () => fetchSubmissions(this.props.params.contestId).then(res => {
            this.setState({ submissions: res });
        });
        intervalFunc();
        this.chatIntervId = setInterval(intervalFunc, 15000);
    }

    componentWillUnmount() {
        clearInterval(this.chatIntervId);
    }

    goToSingleSubmissionPage(cuid) {
        this.props.router.push(`/contest/${this.props.params.contestId}/submissions/admin/${cuid}`);
    }

    millisToMinutesAndSeconds(millis) {
        const minutes = Math.floor(millis / 60000);
        const seconds = ((millis % 60000) / 1000).toFixed(0);
        return (seconds == 60 ? (minutes + 1) + ':00' : minutes + ':' + (seconds < 10 ? '0' : '') + seconds);
    }

    millisToReadableDate(millis) {
        const date = Date(millis);
        return date.toUTCString();
    }

    render() {
        let data = [];
        let loading = true;
        if (this.state.submissions) {
            loading = false;
            this.state.submissions.forEach((submission) => {
                data.push({
                    teamName: submission.teamName,
                    problemName: submission.problemName,
                    feedback: submission.feedback,
                    cuid: submission.cuid,
                    submissionTime: this.millisToReadableDate(submission.submissionTime),
                    timeSinceContestStarted: this.millisToMinutesAndSeconds(submission.timeSinceContestStarted),
                });
            });
        }
        return (
            <div className='submissions-container'>
                <ReactTable
                    loading={loading}
                    data={data}
                    showFilters
                    columns={this.columns}<commit_msg>string<commit_after>import React from 'react';
import { withRouter } from 'react-router';
import { fetchSubmissions } from '../ContestActions.js';
import ReactTable from 'react-table';
import './judgesubmissionpage.css';
import ChatSideBar from '../components/ChatSideBar';

class JudgeSubmissionsPage extends React.Component {

    constructor(props) {
        super(props);
        this.state = {};
        this.columns = [{
            header: 'Team',
            accessor: 'teamName',
        }, {
            header: 'Problem',
            accessor: 'problemName',
        }, {
            header: 'Feedback',
            accessor: 'feedback',
        }, {
            header: 'Submission Time',
            accessor: 'submissionTime',
        }, {
            header: 'Time since contest started',
            accessor: 'timeSinceContestStarted',
        }];
    }

    componentDidMount() {
        const intervalFunc = () => fetchSubmissions(this.props.params.contestId).then(res => {
            this.setState({ submissions: res });
        });
        intervalFunc();
        this.chatIntervId = setInterval(intervalFunc, 15000);
    }

    componentWillUnmount() {
        clearInterval(this.chatIntervId);
    }

    goToSingleSubmissionPage(cuid) {
        this.props.router.push(`/contest/${this.props.params.contestId}/submissions/admin/${cuid}`);
    }

    millisToMinutesAndSeconds(millis) {
        const minutes = Math.floor(millis / 60000);
        const seconds = ((millis % 60000) / 1000).toFixed(0);
        return (seconds == 60 ? (minutes + 1) + ':00' : minutes + ':' + (seconds < 10 ? '0' : '') + seconds);
    }

    millisToReadableDate(millis) {
        const date = Date(millis);
        return date.toString();
    }

    render() {
        let data = [];
        let loading = true;
        if (this.state.submissions) {
            loading = false;
            this.state.submissions.forEach((submission) => {
                data.push({
                    teamName: submission.teamName,
                    problemName: submission.problemName,
                    feedback: submission.feedback,
                    cuid: submission.cuid,
                    submissionTime: this.millisToReadableDate(submission.submissionTime),
                    timeSinceContestStarted: this.millisToMinutesAndSeconds(submission.timeSinceContestStarted),
                });
            });
        }
        return (
            <div className='submissions-container'>
                <ReactTable
                    loading={loading}
                    data={data}
                    showFilters
                    columns={this.columns}
{'fraction_non_alphanumeric': 0.1206444361183964, 'fraction_numerical': 0.01049082053203447, 'mean_word_length': 1.8658078368223296, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '3423829', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1399, 'n_words': 255}