<commit_before>extends submission/info_base
-load staticfiles

block js_media
    script(type='text/javascript', src='{% static "event.js" %}')

    if not submission.is_graded and last_msg
        script(type='text/javascript').
            $(function () {
                var receiver = new EventReceiver(
                    "{{ EVENT_DAEMON_LOCATION }}", "{{ EVENT_DAEMON_POLL_LOCATION }}",
                    ['sub_{{ submission.id }}'], {{ last_msg }}, function (message) {
                        var list = $('#test-cases');
                        switch (message.type) {   
                            case 'internal-error':
                            case 'grading-end':                                                                           
                            case 'compile-error':
                               $('#abort-button').remove();
                               $('#grading-label').remove();
                            case 'test-case':
                            case 'grading-begin':
                            case 'processing':
                                $.ajax({
                                    url: '{% url "submission_testcases_query" %}',
                                    data: {id: '{{ submission.id }}'}
                                }).done(function (data) {
                                    list.html(data);
                                    list.find('.toggle').each(function () {
                                        register_toggle($(this));
                                    });
                                }).fail(function (data) {
                                    console.log('Failed to update testcases!');
                                });
                                
                                if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
                                    $("html, body").animate({ scrollTop: $(document).height() }, 0);
                                }
                                
                        }                        
                    }
                );
            });

block media
    style.
        #test-cases .toggle .fa {
            margin-left: -1.28571em;
        }

        .batch-cases {
            margin: 0;
            padding-left: 1em;
            padding-bottom: 3px;
            padding-top: 3px;
            border: 1px solid #BBB;
            border-left-width: .5em;
            border-radius: 4px;
            color: #222;
            display: inline-block;
        }

        .case-row td:nth-child(3) {
            padding-right: 0;
        }

        .case-row td:nth-child(3) span {
            float: right;
        }

        .case-row td:nth-child(4) {
            text-align: right;
        }

        .case-info {
            margin: 0;
            padding-left: 1em;
            padding-bottom: 3px;
            padding-top: 3px;
            border: 1px solid #BBB;
            border-left-width: .5em;
            border-radius: 4px;
            color: #222;
        }

        .case-output {
            border-left: 4px solid #2980b9;
            padding-left: 6px;
        }

        .submission-info {
            text-align: right;
            float: right;
        }

        .submission-info .submission-date {
            color: gray;
        }

        table td {
            margin: 0;
            padding: 0 5px 0 0;
        }

        .case-AC {
            color: green;
            font-weight: bold;
        }

        .case-_AC {
            color: red;
            font-weight: bold;
        }

        .case-WA {
            color: red;
            font-weight: bold;
        }

        .case-TLE, .case-SC {
            color: gray;
            font-weight: bold;
        }

        .case-MLE, .case-OLE, .case-RTE, .case-IR {
            color: orange;
            font-weight: bold;
        }
    
        .toggle {
            font-weight:normal;
        }

block body
    br
    a(href='{% url "submission_source" submission.id %}') View source
    br
    if request.user == submission.user.user or perms.judge.resubmit_other
        a(href='{% url "problem_submit" submission.problem.code submission.id %}') Resubmit
        br
    hr(style='float:left;width:30%')
    br

    #test-cases
        include submission/status_testcases

    if not submission.is_graded
        if request.user == submission.user.user or perms.judge.abort_any_submission
            #abort-button
                br
                hr(style='float:left;width:30%')
                br
                form(action='{% url "submission_abort" submission.id %}', method='post')
                    -csrf_token
                    input.button(style='float:left', type='submit', value='Abort')
                    br
                    br
            <commit_msg>Add rejudge link to status page; #354<commit_after>extends submission/info_base
-load staticfiles

block js_media
    script(type='text/javascript', src='{% static "event.js" %}')

    if not submission.is_graded and last_msg
        script(type='text/javascript').
            $(function () {
                var receiver = new EventReceiver(
                    "{{ EVENT_DAEMON_LOCATION }}", "{{ EVENT_DAEMON_POLL_LOCATION }}",
                    ['sub_{{ submission.id }}'], {{ last_msg }}, function (message) {
                        var list = $('#test-cases');
                        switch (message.type) {   
                            case 'internal-error':
                            case 'grading-end':                                                                           
                            case 'compile-error':
                               $('#abort-button').remove();
                               $('#grading-label').remove();
                            case 'test-case':
                            case 'grading-begin':
                            case 'processing':
                                $.ajax({
                                    url: '{% url "submission_testcases_query" %}',
                                    data: {id: '{{ submission.id }}'}
                                }).done(function (data) {
                                    list.html(data);
                                    list.find('.toggle').each(function () {
                                        register_toggle($(this));
                                    });
                                }).fail(function (data) {
                                    console.log('Failed to update testcases!');
                                });
                                
                                if($(window).scrollTop() + $(window).height() > $(document).height() - 100) {
                                    $("html, body").animate({ scrollTop: $(document).height() }, 0);
                                }
                                
                        }                        
                    }
                );
            });

block media
    style.
        #test-cases .toggle .fa {
            margin-left: -1.28571em;
        }

        .batch-cases {
            margin: 0;
            padding-left: 1em;
            padding-bottom: 3px;
            padding-top: 3px;
            border: 1px solid #BBB;
            border-left-width: .5em;
            border-radius: 4px;
            color: #222;
            display: inline-block;
        }

        .case-row td:nth-child(3) {
            padding-right: 0;
        }

        .case-row td:nth-child(3) span {
            float: right;
        }

        .case-row td:nth-child(4) {
            text-align: right;
        }

        .case-info {
            margin: 0;
            padding-left: 1em;
            padding-bottom: 3px;
            padding-top: 3px;
            border: 1px solid #BBB;
            border-left-width: .5em;
            border-radius: 4px;
            color: #222;
        }

        .case-output {
            border-left: 4px solid #2980b9;
            padding-left: 6px;
        }

        .submission-info {
            text-align: right;
            float: right;
        }

        .submission-info .submission-date {
            color: gray;
        }

        table td {
            margin: 0;
            padding: 0 5px 0 0;
        }

        .case-AC {
            color: green;
            font-weight: bold;
        }

        .case-_AC {
            color: red;
            font-weight: bold;
        }

        .case-WA {
            color: red;
            font-weight: bold;
        }

        .case-TLE, .case-SC {
            color: gray;
            font-weight: bold;
        }

        .case-MLE, .case-OLE, .case-RTE, .case-IR {
            color: orange;
            font-weight: bold;
        }
    
        .toggle {
            font-weight:normal;
        }

block body
    br
    a(href='{% url "submission_source" submission.id %}') View source
    br
    if request.user == submission.user.user or perms.judge.resubmit_other
        a(href='{% url "problem_submit" submission.problem.code submission.id %}') Resubmit
        br
    if perms.judge.rejudge_submission
        form(action='{% url "submission_rejudge_inline" %}', method='post')
            -csrf_token
            a(href='#', onclick='parentNode.submit();') Rejudge
            input(type='hidden', name='id', value=submission.id)
            input(type='hidden', name='path', value='{% url "submission_status" submission.id %}')
        br

    hr(style='float:left;width:30%')
    br

    #test-cases
        include submission/status_testcases

    if not submission.is_graded
        if request.user == submission.user.user or perms.judge.abort_any_submission
            #abort-button
                br
                hr(style='float:left;width:30%')
                br
                form(action='{% url "submission_abort" submission.id %}', method='post')
                    -csrf_token
                    input.button(style='float:left', type='submit', value='Abort')
                    br
                    br
            
{'fraction_non_alphanumeric': 0.11480897991335172, 'fraction_numerical': 0.010141788105553367, 'mean_word_length': 0.981467030823254, 'pattern_counts': {'":': 0, '<': 3, '<?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': 28, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2469453', 'n_tokens_mistral': 2736, 'n_tokens_neox': 2545, 'n_words': 508}