Description:
add submission view loggin
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r529:32578781bde7 - - 3 files changed: 8 inserted, 2 deleted
@@ -0,0 +1,5 | |||
|
1 | + class AddLastIpToUser < ActiveRecord::Migration | |
|
2 | + def change | |
|
3 | + add_column :users, :last_ip, :string | |
|
4 | + end | |
|
5 | + end |
@@ -41,81 +41,81 | |||
|
41 | 41 | redirect_to :action => 'list' |
|
42 | 42 | end |
|
43 | 43 | |
|
44 | 44 | def clear_terminated |
|
45 | 45 | GraderProcess.find_terminated_graders.each do |p| |
|
46 | 46 | p.destroy |
|
47 | 47 | end |
|
48 | 48 | redirect_to :action => 'list' |
|
49 | 49 | end |
|
50 | 50 | |
|
51 | 51 | def clear_all |
|
52 | 52 | GraderProcess.find(:all).each do |p| |
|
53 | 53 | p.destroy |
|
54 | 54 | end |
|
55 | 55 | redirect_to :action => 'list' |
|
56 | 56 | end |
|
57 | 57 | |
|
58 | 58 | def view |
|
59 | 59 | if params[:type]=='Task' |
|
60 | 60 | redirect_to :action => 'task', :id => params[:id] |
|
61 | 61 | else |
|
62 | 62 | redirect_to :action => 'test_request', :id => params[:id] |
|
63 | 63 | end |
|
64 | 64 | end |
|
65 | 65 | |
|
66 | 66 | def test_request |
|
67 | 67 | @test_request = TestRequest.find(params[:id]) |
|
68 | 68 | end |
|
69 | 69 | |
|
70 | 70 | def task |
|
71 | 71 | @task = Task.find(params[:id]) |
|
72 | 72 | end |
|
73 | 73 | |
|
74 | 74 | def submission |
|
75 | 75 | @submission = Submission.find(params[:id]) |
|
76 | 76 | formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true ) |
|
77 | 77 | lexer = case @submission.language.name |
|
78 | 78 | when "c" then Rouge::Lexers::C.new |
|
79 | 79 | when "cpp" then Rouge::Lexers::Cpp.new |
|
80 | 80 | when "pas" then Rouge::Lexers::Pas.new |
|
81 | 81 | when "ruby" then Rouge::Lexers::Ruby.new |
|
82 | 82 | when "python" then Rouge::Lexers::Python.new |
|
83 | 83 | when "java" then Rouge::Lexers::Java.new |
|
84 | 84 | when "php" then Rouge::Lexers::PHP.new |
|
85 | 85 | end |
|
86 | 86 | @formatted_code = formatter.format(lexer.lex(@submission.source)) |
|
87 | 87 | @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight') |
|
88 | 88 | |
|
89 |
- Submission |
|
|
89 | + SubmissionViewLogs.create(user_id: session[:user_id],submission_id: @submission.id) | |
|
90 | 90 | |
|
91 | 91 | end |
|
92 | 92 | |
|
93 | 93 | # various grader controls |
|
94 | 94 | |
|
95 | 95 | def stop |
|
96 | 96 | grader_proc = GraderProcess.find(params[:id]) |
|
97 | 97 | GraderScript.stop_grader(grader_proc.pid) |
|
98 | 98 | flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.' |
|
99 | 99 | redirect_to :action => 'list' |
|
100 | 100 | end |
|
101 | 101 | |
|
102 | 102 | def stop_all |
|
103 | 103 | GraderScript.stop_graders(GraderProcess.find_running_graders + |
|
104 | 104 | GraderProcess.find_stalled_process) |
|
105 | 105 | flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.' |
|
106 | 106 | redirect_to :action => 'list' |
|
107 | 107 | end |
|
108 | 108 | |
|
109 | 109 | def start_grading |
|
110 | 110 | GraderScript.start_grader('grading') |
|
111 | 111 | flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request' |
|
112 | 112 | redirect_to :action => 'list' |
|
113 | 113 | end |
|
114 | 114 | |
|
115 | 115 | def start_exam |
|
116 | 116 | GraderScript.start_grader('exam') |
|
117 | 117 | flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request' |
|
118 | 118 | redirect_to :action => 'list' |
|
119 | 119 | end |
|
120 | 120 | |
|
121 | 121 | end |
@@ -1,62 +1,62 | |||
|
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 to check this file into your version control system. |
|
13 | 13 | |
|
14 |
- ActiveRecord::Schema.define(:version => 20150827131 |
|
|
14 | + ActiveRecord::Schema.define(:version => 20150827133841) do | |
|
15 | 15 | |
|
16 | 16 | create_table "announcements", :force => true do |t| |
|
17 | 17 | t.string "author" |
|
18 | 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" |
|
25 | 25 | t.string "notes" |
|
26 | 26 | end |
|
27 | 27 | |
|
28 | 28 | create_table "contests", :force => true do |t| |
|
29 | 29 | t.string "title" |
|
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" |
|
34 | 34 | end |
|
35 | 35 | |
|
36 | 36 | create_table "contests_problems", :id => false, :force => true do |t| |
|
37 | 37 | t.integer "contest_id" |
|
38 | 38 | t.integer "problem_id" |
|
39 | 39 | end |
|
40 | 40 | |
|
41 | 41 | create_table "contests_users", :id => false, :force => true do |t| |
|
42 | 42 | t.integer "contest_id" |
|
43 | 43 | t.integer "user_id" |
|
44 | 44 | end |
|
45 | 45 | |
|
46 | 46 | create_table "countries", :force => true do |t| |
|
47 | 47 | t.string "name" |
|
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 => true do |t| |
|
53 | 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 => true do |t| |
|
60 | 60 | t.string "key" |
|
61 | 61 | t.string "value_type" |
|
62 | 62 | t.string "value" |
@@ -204,53 +204,54 | |||
|
204 | 204 | t.datetime "updated_at", :null => false |
|
205 | 205 | end |
|
206 | 206 | |
|
207 | 207 | create_table "test_requests", :force => true do |t| |
|
208 | 208 | t.integer "user_id" |
|
209 | 209 | t.integer "problem_id" |
|
210 | 210 | t.integer "submission_id" |
|
211 | 211 | t.string "input_file_name" |
|
212 | 212 | t.string "output_file_name" |
|
213 | 213 | t.string "running_stat" |
|
214 | 214 | t.integer "status" |
|
215 | 215 | t.datetime "updated_at", :null => false |
|
216 | 216 | t.datetime "submitted_at" |
|
217 | 217 | t.datetime "compiled_at" |
|
218 | 218 | t.text "compiler_message", :limit => 16777215 |
|
219 | 219 | t.datetime "graded_at" |
|
220 | 220 | t.string "grader_comment" |
|
221 | 221 | t.datetime "created_at", :null => false |
|
222 | 222 | t.float "running_time" |
|
223 | 223 | t.string "exit_status" |
|
224 | 224 | t.integer "memory_usage" |
|
225 | 225 | end |
|
226 | 226 | |
|
227 | 227 | add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id" |
|
228 | 228 | |
|
229 | 229 | create_table "user_contest_stats", :force => true do |t| |
|
230 | 230 | t.integer "user_id" |
|
231 | 231 | t.datetime "started_at" |
|
232 | 232 | t.datetime "created_at", :null => false |
|
233 | 233 | t.datetime "updated_at", :null => false |
|
234 | 234 | t.boolean "forced_logout" |
|
235 | 235 | end |
|
236 | 236 | |
|
237 | 237 | create_table "users", :force => true do |t| |
|
238 | 238 | t.string "login", :limit => 50 |
|
239 | 239 | t.string "full_name" |
|
240 | 240 | t.string "hashed_password" |
|
241 | 241 | t.string "salt", :limit => 5 |
|
242 | 242 | t.string "alias" |
|
243 | 243 | t.string "email" |
|
244 | 244 | t.integer "site_id" |
|
245 | 245 | t.integer "country_id" |
|
246 | 246 | t.boolean "activated", :default => false |
|
247 | 247 | t.datetime "created_at" |
|
248 | 248 | t.datetime "updated_at" |
|
249 | 249 | t.string "section" |
|
250 | 250 | t.boolean "enabled", :default => true |
|
251 | 251 | t.string "remark" |
|
252 | + t.string "last_ip" | |
|
252 | 253 | end |
|
253 | 254 | |
|
254 | 255 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
255 | 256 | |
|
256 | 257 | end |
You need to be logged in to leave comments.
Login now