Description:
- change testcase data to longtext by limit size - fix bug in new submission
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r631:79a5d1c218ba - - 4 files changed: 30 inserted, 24 deleted

@@ -0,0 +1,6
1 + class ChangeTestcaseSize < ActiveRecord::Migration
2 + def change
3 + change_column :testcases, :input, :text, :limit => 4294967295
4 + change_column :testcases, :sol, :text, :limit => 4294967295
5 + end
6 + end
@@ -1,31 +1,31
1 1 class HeartbeatController < ApplicationController
2 2 before_filter :admin_authorization, :only => ['index']
3 3
4 4 def edit
5 - @user = User.find_by_login(params[:id])
6 - unless @user
7 - render text: "LOGIN_NOT_FOUND"
8 - return
9 - end
5 + #@user = User.find_by_login(params[:id])
6 + #unless @user
7 + # render text: "LOGIN_NOT_FOUND"
8 + # return
9 + #end
10 10
11 11 #hb = HeartBeat.where(user_id: @user.id, ip_address: request.remote_ip).first
12 12 #puts "status = #{params[:status]}"
13 13 #if hb
14 14 # if params[:status]
15 15 # hb.status = params[:status]
16 16 # hb.save
17 17 # end
18 18 # hb.touch
19 19 #else
20 20 # HeartBeat.creae(user_id: @user.id, ip_address: request.remote_ip)
21 21 #end
22 - HeartBeat.create(user_id: @user.id, ip_address: request.remote_ip, status: params[:status])
22 + #HeartBeat.create(user_id: @user.id, ip_address: request.remote_ip, status: params[:status])
23 23
24 24 render text: (GraderConfiguration['right.heartbeat_response'] || 'OK')
25 25 end
26 26
27 27 def index
28 28 @hb = HeartBeat.where("updated_at >= ?",Time.zone.now-2.hours).includes(:user).order(:user_id).all
29 29 @num = HeartBeat.where("updated_at >= ?",Time.zone.now-5.minutes).count(:user_id,distinct: true)
30 30 end
31 31 end
@@ -1,79 +1,79
1 1 %h2 Live submit
2 2 %br
3 3
4 4 %textarea#text_haha{style: "display:none"}~ @source
5 5 .container
6 6 .row
7 7 .col-md-12
8 8 .alert.alert-info
9 9 Write your code in the following box, choose language, and click submit button when finished
10 10 .row
11 11 .col-md-8
12 12 %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'}
13 13 .col-md-4
14 14 = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do
15 15
16 16 = hidden_field_tag 'editor_text', @source
17 17 = hidden_field_tag 'submission[problem_id]', @problem.id
18 18 .form-group
19 19 = label_tag "Task:"
20 20 = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true
21 21
22 22 .form-group
23 23 = label_tag 'Language'
24 24 = 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"
25 25 .form-group
26 26 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
27 27 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
28 28 .panel.panel-info
29 29 .panel-heading
30 30 Latest Submission Status
31 - = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true
31 + = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
32 32 .panel-body
33 33 - if @submission
34 34 = render :partial => 'submission_short',
35 35 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
36 36 .row
37 37 .col-md-12
38 38 %h2 Console
39 39 %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20}
40 40
41 41 :javascript
42 42 $(document).ready(function() {
43 43 e = ace.edit("editor")
44 44 e.setValue($("#text_haha").val());
45 45 e.gotoLine(1);
46 46 $("#language_id").trigger('change');
47 47 brython();
48 48 });
49 49
50 50
51 51 %script#__main__{type:'text/python3'}
52 52 :plain
53 53 import sys
54 54 import traceback
55 55
56 56 from browser import document as doc
57 57 from browser import window, alert, console
58 58
59 59 _credits = """ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
60 60 for supporting Python development. See www.python.org for more information."""
61 61
62 62 _copyright = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
63 63 All Rights Reserved.
64 64
65 65 Copyright (c) 2001-2013 Python Software Foundation.
66 66 All Rights Reserved.
67 67
68 68 Copyright (c) 2000 BeOpen.com.
69 69 All Rights Reserved.
70 70
71 71 Copyright (c) 1995-2001 Corporation for National Research Initiatives.
72 72 All Rights Reserved.
73 73
74 74 Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
75 75 All Rights Reserved."""
76 76
77 77 _license = """Copyright (c) 2012, Pierre Quentel pierre.quentel@gmail.com
78 78 All rights reserved.
79 79
@@ -1,280 +1,280
1 1 # encoding: UTF-8
2 2 # This file is auto-generated from the current state of the database. Instead
3 3 # of editing this file, please use the migrations feature of Active Record to
4 4 # incrementally modify your database, and then regenerate this schema definition.
5 5 #
6 6 # Note that this schema.rb definition is the authoritative source for your
7 7 # database schema. If you need to create the application database on another
8 8 # system, you should be using db:schema:load, not running all the migrations
9 9 # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 10 # you'll amass, the slower it'll run and the greater likelihood for issues).
11 11 #
12 12 # It's strongly recommended that you check this file into your version control system.
13 13
14 - ActiveRecord::Schema.define(version: 20161031063337) do
14 + ActiveRecord::Schema.define(version: 20170123162543) do
15 15
16 16 create_table "announcements", force: :cascade do |t|
17 17 t.string "author", limit: 255
18 - t.text "body", limit: 65535
18 + t.text "body", limit: 16777215
19 19 t.boolean "published"
20 20 t.datetime "created_at", null: false
21 21 t.datetime "updated_at", null: false
22 22 t.boolean "frontpage", default: false
23 23 t.boolean "contest_only", default: false
24 24 t.string "title", limit: 255
25 25 t.string "notes", limit: 255
26 26 end
27 27
28 28 create_table "contests", force: :cascade do |t|
29 29 t.string "title", limit: 255
30 30 t.boolean "enabled"
31 31 t.datetime "created_at", null: false
32 32 t.datetime "updated_at", null: false
33 33 t.string "name", limit: 255
34 34 end
35 35
36 36 create_table "contests_problems", id: false, force: :cascade do |t|
37 37 t.integer "contest_id", limit: 4
38 38 t.integer "problem_id", limit: 4
39 39 end
40 40
41 41 create_table "contests_users", id: false, force: :cascade do |t|
42 42 t.integer "contest_id", limit: 4
43 43 t.integer "user_id", limit: 4
44 44 end
45 45
46 46 create_table "countries", force: :cascade do |t|
47 47 t.string "name", limit: 255
48 48 t.datetime "created_at", null: false
49 49 t.datetime "updated_at", null: false
50 50 end
51 51
52 52 create_table "descriptions", force: :cascade do |t|
53 - t.text "body", limit: 65535
53 + t.text "body", limit: 16777215
54 54 t.boolean "markdowned"
55 55 t.datetime "created_at", null: false
56 56 t.datetime "updated_at", null: false
57 57 end
58 58
59 59 create_table "grader_configurations", force: :cascade do |t|
60 60 t.string "key", limit: 255
61 61 t.string "value_type", limit: 255
62 62 t.string "value", limit: 255
63 63 t.datetime "created_at", null: false
64 64 t.datetime "updated_at", null: false
65 - t.text "description", limit: 65535
65 + t.text "description", limit: 16777215
66 66 end
67 67
68 68 create_table "grader_processes", force: :cascade do |t|
69 69 t.string "host", limit: 255
70 70 t.integer "pid", limit: 4
71 71 t.string "mode", limit: 255
72 72 t.boolean "active"
73 73 t.datetime "created_at", null: false
74 74 t.datetime "updated_at", null: false
75 75 t.integer "task_id", limit: 4
76 76 t.string "task_type", limit: 255
77 77 t.boolean "terminated"
78 78 end
79 79
80 80 add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid", using: :btree
81 81
82 82 create_table "heart_beats", force: :cascade do |t|
83 83 t.integer "user_id", limit: 4
84 84 t.string "ip_address", limit: 255
85 85 t.datetime "created_at", null: false
86 86 t.datetime "updated_at", null: false
87 87 t.string "status", limit: 255
88 88 end
89 89
90 90 add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at", using: :btree
91 91
92 92 create_table "languages", force: :cascade do |t|
93 93 t.string "name", limit: 10
94 94 t.string "pretty_name", limit: 255
95 95 t.string "ext", limit: 10
96 96 t.string "common_ext", limit: 255
97 97 end
98 98
99 99 create_table "logins", force: :cascade do |t|
100 100 t.integer "user_id", limit: 4
101 101 t.string "ip_address", limit: 255
102 102 t.datetime "created_at", null: false
103 103 t.datetime "updated_at", null: false
104 104 end
105 105
106 106 create_table "messages", force: :cascade do |t|
107 107 t.integer "sender_id", limit: 4
108 108 t.integer "receiver_id", limit: 4
109 109 t.integer "replying_message_id", limit: 4
110 - t.text "body", limit: 65535
110 + t.text "body", limit: 16777215
111 111 t.boolean "replied"
112 112 t.datetime "created_at", null: false
113 113 t.datetime "updated_at", null: false
114 114 end
115 115
116 116 create_table "problems", force: :cascade do |t|
117 117 t.string "name", limit: 30
118 118 t.string "full_name", limit: 255
119 119 t.integer "full_score", limit: 4
120 120 t.date "date_added"
121 121 t.boolean "available"
122 122 t.string "url", limit: 255
123 123 t.integer "description_id", limit: 4
124 124 t.boolean "test_allowed"
125 125 t.boolean "output_only"
126 126 t.string "description_filename", limit: 255
127 127 end
128 128
129 129 create_table "rights", force: :cascade do |t|
130 130 t.string "name", limit: 255
131 131 t.string "controller", limit: 255
132 132 t.string "action", limit: 255
133 133 end
134 134
135 135 create_table "rights_roles", id: false, force: :cascade do |t|
136 136 t.integer "right_id", limit: 4
137 137 t.integer "role_id", limit: 4
138 138 end
139 139
140 140 add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id", using: :btree
141 141
142 142 create_table "roles", force: :cascade do |t|
143 143 t.string "name", limit: 255
144 144 end
145 145
146 146 create_table "roles_users", id: false, force: :cascade do |t|
147 147 t.integer "role_id", limit: 4
148 148 t.integer "user_id", limit: 4
149 149 end
150 150
151 151 add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id", using: :btree
152 152
153 153 create_table "sessions", force: :cascade do |t|
154 154 t.string "session_id", limit: 255
155 - t.text "data", limit: 65535
155 + t.text "data", limit: 16777215
156 156 t.datetime "updated_at"
157 157 end
158 158
159 159 add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
160 160 add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
161 161
162 162 create_table "sites", force: :cascade do |t|
163 163 t.string "name", limit: 255
164 164 t.boolean "started"
165 165 t.datetime "start_time"
166 166 t.datetime "created_at", null: false
167 167 t.datetime "updated_at", null: false
168 168 t.integer "country_id", limit: 4
169 169 t.string "password", limit: 255
170 170 end
171 171
172 172 create_table "submission_view_logs", force: :cascade do |t|
173 173 t.integer "user_id", limit: 4
174 174 t.integer "submission_id", limit: 4
175 175 t.datetime "created_at", null: false
176 176 t.datetime "updated_at", null: false
177 177 end
178 178
179 179 create_table "submissions", force: :cascade do |t|
180 180 t.integer "user_id", limit: 4
181 181 t.integer "problem_id", limit: 4
182 182 t.integer "language_id", limit: 4
183 - t.text "source", limit: 65535
183 + t.text "source", limit: 16777215
184 184 t.binary "binary", limit: 65535
185 185 t.datetime "submitted_at"
186 186 t.datetime "compiled_at"
187 - t.text "compiler_message", limit: 65535
187 + t.text "compiler_message", limit: 16777215
188 188 t.datetime "graded_at"
189 189 t.integer "points", limit: 4
190 - t.text "grader_comment", limit: 65535
190 + t.text "grader_comment", limit: 16777215
191 191 t.integer "number", limit: 4
192 192 t.string "source_filename", limit: 255
193 193 t.float "max_runtime", limit: 24
194 194 t.integer "peak_memory", limit: 4
195 195 t.integer "effective_code_length", limit: 4
196 196 t.string "ip_address", limit: 255
197 197 end
198 198
199 199 add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true, using: :btree
200 200 add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree
201 201
202 202 create_table "tasks", force: :cascade do |t|
203 203 t.integer "submission_id", limit: 4
204 204 t.datetime "created_at"
205 205 t.integer "status", limit: 4
206 206 t.datetime "updated_at"
207 207 end
208 208
209 209 create_table "test_pairs", force: :cascade do |t|
210 210 t.integer "problem_id", limit: 4
211 - t.text "input", limit: 16777215
212 - t.text "solution", limit: 16777215
211 + t.text "input", limit: 4294967295
212 + t.text "solution", limit: 4294967295
213 213 t.datetime "created_at", null: false
214 214 t.datetime "updated_at", null: false
215 215 end
216 216
217 217 create_table "test_requests", force: :cascade do |t|
218 218 t.integer "user_id", limit: 4
219 219 t.integer "problem_id", limit: 4
220 220 t.integer "submission_id", limit: 4
221 221 t.string "input_file_name", limit: 255
222 222 t.string "output_file_name", limit: 255
223 223 t.string "running_stat", limit: 255
224 224 t.integer "status", limit: 4
225 225 t.datetime "updated_at", null: false
226 226 t.datetime "submitted_at"
227 227 t.datetime "compiled_at"
228 - t.text "compiler_message", limit: 65535
228 + t.text "compiler_message", limit: 16777215
229 229 t.datetime "graded_at"
230 230 t.string "grader_comment", limit: 255
231 231 t.datetime "created_at", null: false
232 232 t.float "running_time", limit: 24
233 233 t.string "exit_status", limit: 255
234 234 t.integer "memory_usage", limit: 4
235 235 end
236 236
237 237 add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id", using: :btree
238 238
239 239 create_table "testcases", force: :cascade do |t|
240 240 t.integer "problem_id", limit: 4
241 241 t.integer "num", limit: 4
242 242 t.integer "group", limit: 4
243 243 t.integer "score", limit: 4
244 - t.text "input", limit: 65535
245 - t.text "sol", limit: 65535
246 - t.datetime "created_at"
247 - t.datetime "updated_at"
244 + t.text "input", limit: 4294967295
245 + t.text "sol", limit: 4294967295
246 + t.datetime "created_at", null: false
247 + t.datetime "updated_at", null: false
248 248 end
249 249
250 250 add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id", using: :btree
251 251
252 252 create_table "user_contest_stats", force: :cascade do |t|
253 253 t.integer "user_id", limit: 4
254 254 t.datetime "started_at"
255 255 t.datetime "created_at", null: false
256 256 t.datetime "updated_at", null: false
257 257 t.boolean "forced_logout"
258 258 end
259 259
260 260 create_table "users", force: :cascade do |t|
261 261 t.string "login", limit: 50
262 262 t.string "full_name", limit: 255
263 263 t.string "hashed_password", limit: 255
264 264 t.string "salt", limit: 5
265 265 t.string "alias", limit: 255
266 266 t.string "email", limit: 255
267 267 t.integer "site_id", limit: 4
268 268 t.integer "country_id", limit: 4
269 269 t.boolean "activated", default: false
270 270 t.datetime "created_at"
271 271 t.datetime "updated_at"
272 + t.string "section", limit: 255
272 273 t.boolean "enabled", default: true
273 274 t.string "remark", limit: 255
274 275 t.string "last_ip", limit: 255
275 - t.string "section", limit: 255
276 276 end
277 277
278 278 add_index "users", ["login"], name: "index_users_on_login", unique: true, using: :btree
279 279
280 280 end
You need to be logged in to leave comments. Login now