Description:
fixed new submission error showing nil compiler message
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r772:72eb3ebb9aef - - 1 file changed: 3 inserted, 1 deleted

@@ -14,97 +14,99
14 14 - # submission form
15 15 = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do
16 16
17 17 = hidden_field_tag 'editor_text', @source
18 18 = hidden_field_tag 'submission[problem_id]', @problem.id
19 19 .form-group
20 20 = label_tag "Task:"
21 21 = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true
22 22 .form-group
23 23 = label_tag "Description:"
24 24 = link_to_description_if_any "[download] <span class='glyphicon glyphicon-file'></span>".html_safe, @problem
25 25
26 26 .form-group
27 27 = label_tag 'Language:'
28 28 = select_tag 'language_id', options_from_collection_for_select(Language.all, 'id', 'pretty_name', @lang_id || Language.find_by_pretty_name("Python").id || Language.first.id), class: 'form-control select', style: "width: 100px"
29 29 .form-group
30 30 .input-group
31 31 %span.input-group-btn
32 32 %span.btn.btn-default.btn-file
33 33 Browse
34 34 = file_field_tag 'load_file'
35 35 = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
36 36 .form-group
37 37 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
38 38 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
39 39 - # latest submission status
40 40 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
41 41 .panel-heading
42 42 Latest Submission Status
43 43 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
44 44 .panel-body
45 45 %div#latest_status
46 46 - if @submission
47 47 = render :partial => 'submission_short',
48 48 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
49 49 .row
50 50 .col-md-12
51 51 %h2 Console
52 52 %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20}
53 53
54 54 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
55 55 .modal-dialog.modal-lg{role:'document'}
56 56 .modal-content
57 57 .modal-header
58 58 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
59 59 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
60 60 %h4 Compiler message
61 61 .modal-body
62 - %pre#compiler_msg= @submission.compiler_message
62 + %pre#compiler_msg
63 + - if @submission
64 + = @submission.compiler_message
63 65 .modal-footer
64 66 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
65 67
66 68 :javascript
67 69 $(document).ready(function() {
68 70 e = ace.edit("editor")
69 71 e.setValue($("#text_sourcecode").val());
70 72 e.gotoLine(1);
71 73 $("#language_id").trigger('change');
72 74
73 75 $("#load_file").on('change',function(evt) {
74 76 var file = evt.target.files[0];
75 77 var reader = new FileReader();
76 78 reader.onload = function(theFile) {
77 79 var e = ace.edit("editor")
78 80 e.setValue(theFile.target.result);
79 81 e.gotoLine(1);
80 82 };
81 83 reader.readAsText(file)
82 84 });
83 85
84 86 //brython();
85 87 });
86 88
87 89
88 90
89 91
90 92
91 93 %script#__main__{type:'text/python3'}
92 94 :plain
93 95 import sys
94 96 import traceback
95 97
96 98 from browser import document as doc
97 99 from browser import window, alert, console
98 100
99 101 _credits = """ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
100 102 for supporting Python development. See www.python.org for more information."""
101 103
102 104 _copyright = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
103 105 All Rights Reserved.
104 106
105 107 Copyright (c) 2001-2013 Python Software Foundation.
106 108 All Rights Reserved.
107 109
108 110 Copyright (c) 2000 BeOpen.com.
109 111 All Rights Reserved.
110 112
You need to be logged in to leave comments. Login now