Description:
NOT WORKING add submission view log
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r528:dfe79b5eef35 - - 7 files changed: 137 inserted, 28 deleted

@@ -0,0 +1,3
1 + class SubmissionViewLogs < ActiveRecord::Base
2 + attr_accessible :submission_id, :user_id
3 + end
@@ -0,0 +1,82
1 + - content_for :header do
2 + = stylesheet_link_tag 'tablesorter-theme.cafe'
3 + = javascript_include_tag 'local_jquery'
4 +
5 + %script{:type=>"text/javascript"}
6 + $(function () {
7 + $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} );
8 + $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} );
9 + $('#my_table').tablesorter({widthFixed: true, widgets: ['zebra']});
10 + $('#my_table2').tablesorter({widthFixed: true, widgets: ['zebra']});
11 + $('#sub_table').tablesorter({widthFixed: true, widgets: ['zebra']});
12 + });
13 +
14 + %h1 Login status
15 +
16 + =render partial: 'report_menu'
17 +
18 +
19 + = form_tag({session: :url }) do
20 + .submitbox
21 + %table
22 + %tr
23 + %td{colspan: 6, style: 'font-weight: bold'}= 'Query login & submit in the range'
24 + %tr
25 + %td{style: 'width: 120px; font-weight: bold'}= 'Login date range'
26 + %td{align: 'right'} since:
27 + %td= text_field_tag 'since_datetime', @since_time
28 + %tr
29 + %td
30 + %td{align: 'right'} until:
31 + %td= text_field_tag 'until_datetime', @until_time
32 + %tr
33 + %td
34 + %td
35 + %td Blank mean no condition
36 + %tr
37 + %td{style: 'width: 120px; font-weight: bold'}= "ID"
38 + %td{colspan: 2}= text_field_tag 'SID', @sid, size: 40
39 + %tr
40 + %td
41 + %td
42 + %td= submit_tag 'query'
43 +
44 +
45 + %h2 Logs
46 +
47 + - if @sid
48 + %table
49 + %tbody
50 + - @sid.each do |id|
51 + - user = User.where("login = ?",id).first
52 + %tr
53 + //%td= link_to id, controller: :user, action: :profile, id: id
54 + %td= link_to id, "https://www.nattee.net/java/users/profile/#{user.id}"
55 + %td= user.full_name
56 +
57 + //%table.tablesorter-cafe#my_table
58 + %table.info
59 + %thead
60 + %tr.info-head
61 + %th Time
62 + %th Action
63 + %th IP
64 + %th login
65 + %th name
66 + %th problem
67 + %th score
68 + %tbody
69 + - if @logs
70 + - @logs.each do |l|
71 + %tr{class: cycle('info-even','info-odd')}
72 + %td= l[:submitted_at].strftime "%Y.%b.%d %H:%M:%S"
73 + //%td= l[:id] == -1 ? "LOGIN" : link_to("submit #{l[:id]}", controller: 'graders' , action: 'submission', id: l[:id])
74 + %td= l[:id] == -1 ? "LOGIN" : link_to( "submit #{l[:id]}", "https://www.nattee.net/java/graders/submission/#{l[:id]}")
75 + %td= l[:ip_address]
76 + //%td= link_to l[:login], controller: 'users', action: 'profile', id: l[:id]
77 + %td= link_to( l[:login], "https://www.nattee.net/java/users/profile/#{l.user_id}")
78 + %td= l[:full_name]
79 + %td= l[:id] == -1 ? "" : l.problem.name
80 + %td= l[:id] == -1 ? "" : l.points * 100/ l.problem.full_score
81 +
82 +
@@ -0,0 +1,10
1 + class CreateSubmissionViewLogs < ActiveRecord::Migration
2 + def change
3 + create_table :submission_view_logs do |t|
4 + t.integer :user_id
5 + t.integer :submission_id
6 +
7 + t.timestamps
8 + end
9 + end
10 + end
@@ -0,0 +1,5
1 + require 'spec_helper'
2 +
3 + describe SubmissionViewLogs do
4 + pending "add some examples to (or delete) #{__FILE__}"
5 + end
@@ -33,97 +33,97
33 activeresource (3.2.21)
33 activeresource (3.2.21)
34 activemodel (= 3.2.21)
34 activemodel (= 3.2.21)
35 activesupport (= 3.2.21)
35 activesupport (= 3.2.21)
36 activesupport (3.2.21)
36 activesupport (3.2.21)
37 i18n (~> 0.6, >= 0.6.4)
37 i18n (~> 0.6, >= 0.6.4)
38 multi_json (~> 1.0)
38 multi_json (~> 1.0)
39 arel (3.0.3)
39 arel (3.0.3)
40 best_in_place (3.0.3)
40 best_in_place (3.0.3)
41 actionpack (>= 3.2)
41 actionpack (>= 3.2)
42 railties (>= 3.2)
42 railties (>= 3.2)
43 builder (3.0.4)
43 builder (3.0.4)
44 coffee-rails (3.2.2)
44 coffee-rails (3.2.2)
45 coffee-script (>= 2.2.0)
45 coffee-script (>= 2.2.0)
46 railties (~> 3.2.0)
46 railties (~> 3.2.0)
47 coffee-script (2.3.0)
47 coffee-script (2.3.0)
48 coffee-script-source
48 coffee-script-source
49 execjs
49 execjs
50 coffee-script-source (1.9.0)
50 coffee-script-source (1.9.0)
51 diff-lcs (1.2.5)
51 diff-lcs (1.2.5)
52 dynamic_form (1.1.4)
52 dynamic_form (1.1.4)
53 erubis (2.7.0)
53 erubis (2.7.0)
54 execjs (2.3.0)
54 execjs (2.3.0)
55 haml (4.0.6)
55 haml (4.0.6)
56 tilt
56 tilt
57 hike (1.2.3)
57 hike (1.2.3)
58 i18n (0.7.0)
58 i18n (0.7.0)
59 in_place_editing (1.2.0)
59 in_place_editing (1.2.0)
60 journey (1.0.4)
60 journey (1.0.4)
61 jquery-rails (3.1.2)
61 jquery-rails (3.1.2)
62 railties (>= 3.0, < 5.0)
62 railties (>= 3.0, < 5.0)
63 thor (>= 0.14, < 2.0)
63 thor (>= 0.14, < 2.0)
64 jquery-tablesorter (1.13.4)
64 jquery-tablesorter (1.13.4)
65 railties (>= 3.1, < 5)
65 railties (>= 3.1, < 5)
66 jquery-timepicker-addon-rails (1.4.1)
66 jquery-timepicker-addon-rails (1.4.1)
67 railties (>= 3.1)
67 railties (>= 3.1)
68 jquery-ui-rails (4.0.3)
68 jquery-ui-rails (4.0.3)
69 jquery-rails
69 jquery-rails
70 railties (>= 3.1.0)
70 railties (>= 3.1.0)
71 jquery-ui-sass-rails (4.0.3.0)
71 jquery-ui-sass-rails (4.0.3.0)
72 jquery-rails
72 jquery-rails
73 jquery-ui-rails (= 4.0.3)
73 jquery-ui-rails (= 4.0.3)
74 railties (>= 3.1.0)
74 railties (>= 3.1.0)
75 json (1.8.2)
75 json (1.8.2)
76 mail (2.5.4)
76 mail (2.5.4)
77 mime-types (~> 1.16)
77 mime-types (~> 1.16)
78 treetop (~> 1.4.8)
78 treetop (~> 1.4.8)
79 mime-types (1.25.1)
79 mime-types (1.25.1)
80 multi_json (1.10.1)
80 multi_json (1.10.1)
81 - mysql2 (0.3.17)
81 + mysql2 (0.3.20)
82 polyglot (0.3.5)
82 polyglot (0.3.5)
83 power_assert (0.2.2)
83 power_assert (0.2.2)
84 prototype-rails (3.2.1)
84 prototype-rails (3.2.1)
85 rails (~> 3.2)
85 rails (~> 3.2)
86 rack (1.4.5)
86 rack (1.4.5)
87 rack-cache (1.2)
87 rack-cache (1.2)
88 rack (>= 0.4)
88 rack (>= 0.4)
89 rack-ssl (1.3.4)
89 rack-ssl (1.3.4)
90 rack
90 rack
91 rack-test (0.6.3)
91 rack-test (0.6.3)
92 rack (>= 1.0)
92 rack (>= 1.0)
93 rails (3.2.21)
93 rails (3.2.21)
94 actionmailer (= 3.2.21)
94 actionmailer (= 3.2.21)
95 actionpack (= 3.2.21)
95 actionpack (= 3.2.21)
96 activerecord (= 3.2.21)
96 activerecord (= 3.2.21)
97 activeresource (= 3.2.21)
97 activeresource (= 3.2.21)
98 activesupport (= 3.2.21)
98 activesupport (= 3.2.21)
99 bundler (~> 1.0)
99 bundler (~> 1.0)
100 railties (= 3.2.21)
100 railties (= 3.2.21)
101 railties (3.2.21)
101 railties (3.2.21)
102 actionpack (= 3.2.21)
102 actionpack (= 3.2.21)
103 activesupport (= 3.2.21)
103 activesupport (= 3.2.21)
104 rack-ssl (~> 1.3.2)
104 rack-ssl (~> 1.3.2)
105 rake (>= 0.8.7)
105 rake (>= 0.8.7)
106 rdoc (~> 3.4)
106 rdoc (~> 3.4)
107 thor (>= 0.14.6, < 2.0)
107 thor (>= 0.14.6, < 2.0)
108 rake (10.4.2)
108 rake (10.4.2)
109 rdiscount (2.1.8)
109 rdiscount (2.1.8)
110 rdoc (3.12.2)
110 rdoc (3.12.2)
111 json (~> 1.4)
111 json (~> 1.4)
112 rouge (1.8.0)
112 rouge (1.8.0)
113 rspec-collection_matchers (1.1.2)
113 rspec-collection_matchers (1.1.2)
114 rspec-expectations (>= 2.99.0.beta1)
114 rspec-expectations (>= 2.99.0.beta1)
115 rspec-core (2.99.2)
115 rspec-core (2.99.2)
116 rspec-expectations (2.99.2)
116 rspec-expectations (2.99.2)
117 diff-lcs (>= 1.1.3, < 2.0)
117 diff-lcs (>= 1.1.3, < 2.0)
118 rspec-mocks (2.99.3)
118 rspec-mocks (2.99.3)
119 rspec-rails (2.99.0)
119 rspec-rails (2.99.0)
120 actionpack (>= 3.0)
120 actionpack (>= 3.0)
121 activemodel (>= 3.0)
121 activemodel (>= 3.0)
122 activesupport (>= 3.0)
122 activesupport (>= 3.0)
123 railties (>= 3.0)
123 railties (>= 3.0)
124 rspec-collection_matchers
124 rspec-collection_matchers
125 rspec-core (~> 2.99.0)
125 rspec-core (~> 2.99.0)
126 rspec-expectations (~> 2.99.0)
126 rspec-expectations (~> 2.99.0)
127 rspec-mocks (~> 2.99.0)
127 rspec-mocks (~> 2.99.0)
128 sass (3.4.11)
128 sass (3.4.11)
129 sass-rails (3.2.6)
129 sass-rails (3.2.6)
@@ -41,79 +41,81
41 redirect_to :action => 'list'
41 redirect_to :action => 'list'
42 end
42 end
43
43
44 def clear_terminated
44 def clear_terminated
45 GraderProcess.find_terminated_graders.each do |p|
45 GraderProcess.find_terminated_graders.each do |p|
46 p.destroy
46 p.destroy
47 end
47 end
48 redirect_to :action => 'list'
48 redirect_to :action => 'list'
49 end
49 end
50
50
51 def clear_all
51 def clear_all
52 GraderProcess.find(:all).each do |p|
52 GraderProcess.find(:all).each do |p|
53 p.destroy
53 p.destroy
54 end
54 end
55 redirect_to :action => 'list'
55 redirect_to :action => 'list'
56 end
56 end
57
57
58 def view
58 def view
59 if params[:type]=='Task'
59 if params[:type]=='Task'
60 redirect_to :action => 'task', :id => params[:id]
60 redirect_to :action => 'task', :id => params[:id]
61 else
61 else
62 redirect_to :action => 'test_request', :id => params[:id]
62 redirect_to :action => 'test_request', :id => params[:id]
63 end
63 end
64 end
64 end
65
65
66 def test_request
66 def test_request
67 @test_request = TestRequest.find(params[:id])
67 @test_request = TestRequest.find(params[:id])
68 end
68 end
69
69
70 def task
70 def task
71 @task = Task.find(params[:id])
71 @task = Task.find(params[:id])
72 end
72 end
73
73
74 def submission
74 def submission
75 @submission = Submission.find(params[:id])
75 @submission = Submission.find(params[:id])
76 formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true )
76 formatter = Rouge::Formatters::HTML.new(css_class: 'highlight', line_numbers: true )
77 lexer = case @submission.language.name
77 lexer = case @submission.language.name
78 when "c" then Rouge::Lexers::C.new
78 when "c" then Rouge::Lexers::C.new
79 when "cpp" then Rouge::Lexers::Cpp.new
79 when "cpp" then Rouge::Lexers::Cpp.new
80 when "pas" then Rouge::Lexers::Pas.new
80 when "pas" then Rouge::Lexers::Pas.new
81 when "ruby" then Rouge::Lexers::Ruby.new
81 when "ruby" then Rouge::Lexers::Ruby.new
82 when "python" then Rouge::Lexers::Python.new
82 when "python" then Rouge::Lexers::Python.new
83 when "java" then Rouge::Lexers::Java.new
83 when "java" then Rouge::Lexers::Java.new
84 when "php" then Rouge::Lexers::PHP.new
84 when "php" then Rouge::Lexers::PHP.new
85 end
85 end
86 @formatted_code = formatter.format(lexer.lex(@submission.source))
86 @formatted_code = formatter.format(lexer.lex(@submission.source))
87 @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight')
87 @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight')
88
88
89 + SubmissionLogView.create(user_id: user.id,submission_id: @submission.id)
90 +
89 end
91 end
90
92
91 # various grader controls
93 # various grader controls
92
94
93 def stop
95 def stop
94 grader_proc = GraderProcess.find(params[:id])
96 grader_proc = GraderProcess.find(params[:id])
95 GraderScript.stop_grader(grader_proc.pid)
97 GraderScript.stop_grader(grader_proc.pid)
96 flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.'
98 flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.'
97 redirect_to :action => 'list'
99 redirect_to :action => 'list'
98 end
100 end
99
101
100 def stop_all
102 def stop_all
101 GraderScript.stop_graders(GraderProcess.find_running_graders +
103 GraderScript.stop_graders(GraderProcess.find_running_graders +
102 GraderProcess.find_stalled_process)
104 GraderProcess.find_stalled_process)
103 flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.'
105 flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.'
104 redirect_to :action => 'list'
106 redirect_to :action => 'list'
105 end
107 end
106
108
107 def start_grading
109 def start_grading
108 GraderScript.start_grader('grading')
110 GraderScript.start_grader('grading')
109 flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request'
111 flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request'
110 redirect_to :action => 'list'
112 redirect_to :action => 'list'
111 end
113 end
112
114
113 def start_exam
115 def start_exam
114 GraderScript.start_grader('exam')
116 GraderScript.start_grader('exam')
115 flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request'
117 flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request'
116 redirect_to :action => 'list'
118 redirect_to :action => 'list'
117 end
119 end
118
120
119 end
121 end
@@ -1,249 +1,256
1 # encoding: UTF-8
1 # encoding: UTF-8
2 # This file is auto-generated from the current state of the database. Instead
2 # This file is auto-generated from the current state of the database. Instead
3 # of editing this file, please use the migrations feature of Active Record to
3 # of editing this file, please use the migrations feature of Active Record to
4 # incrementally modify your database, and then regenerate this schema definition.
4 # incrementally modify your database, and then regenerate this schema definition.
5 #
5 #
6 # Note that this schema.rb definition is the authoritative source for your
6 # Note that this schema.rb definition is the authoritative source for your
7 # database schema. If you need to create the application database on another
7 # database schema. If you need to create the application database on another
8 # system, you should be using db:schema:load, not running all the migrations
8 # system, you should be using db:schema:load, not running all the migrations
9 # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10 # you'll amass, the slower it'll run and the greater likelihood for issues).
10 # you'll amass, the slower it'll run and the greater likelihood for issues).
11 #
11 #
12 # It's strongly recommended to check this file into your version control system.
12 # It's strongly recommended to check this file into your version control system.
13
13
14 - ActiveRecord::Schema.define(:version => 20150618085823) do
14 + ActiveRecord::Schema.define(:version => 20150827131927) do
15
15
16 create_table "announcements", :force => true do |t|
16 create_table "announcements", :force => true do |t|
17 t.string "author"
17 t.string "author"
18 - t.text "body"
18 + t.text "body", :limit => 16777215
19 t.boolean "published"
19 t.boolean "published"
20 - t.datetime "created_at", :null => false
20 + t.datetime "created_at", :null => false
21 - t.datetime "updated_at", :null => false
21 + t.datetime "updated_at", :null => false
22 - t.boolean "frontpage", :default => false
22 + t.boolean "frontpage", :default => false
23 - t.boolean "contest_only", :default => false
23 + t.boolean "contest_only", :default => false
24 t.string "title"
24 t.string "title"
25 t.string "notes"
25 t.string "notes"
26 end
26 end
27
27
28 create_table "contests", :force => true do |t|
28 create_table "contests", :force => true do |t|
29 t.string "title"
29 t.string "title"
30 t.boolean "enabled"
30 t.boolean "enabled"
31 t.datetime "created_at", :null => false
31 t.datetime "created_at", :null => false
32 t.datetime "updated_at", :null => false
32 t.datetime "updated_at", :null => false
33 t.string "name"
33 t.string "name"
34 end
34 end
35
35
36 create_table "contests_problems", :id => false, :force => true do |t|
36 create_table "contests_problems", :id => false, :force => true do |t|
37 t.integer "contest_id"
37 t.integer "contest_id"
38 t.integer "problem_id"
38 t.integer "problem_id"
39 end
39 end
40
40
41 create_table "contests_users", :id => false, :force => true do |t|
41 create_table "contests_users", :id => false, :force => true do |t|
42 t.integer "contest_id"
42 t.integer "contest_id"
43 t.integer "user_id"
43 t.integer "user_id"
44 end
44 end
45
45
46 create_table "countries", :force => true do |t|
46 create_table "countries", :force => true do |t|
47 t.string "name"
47 t.string "name"
48 t.datetime "created_at", :null => false
48 t.datetime "created_at", :null => false
49 t.datetime "updated_at", :null => false
49 t.datetime "updated_at", :null => false
50 end
50 end
51
51
52 create_table "descriptions", :force => true do |t|
52 create_table "descriptions", :force => true do |t|
53 - t.text "body"
53 + t.text "body", :limit => 16777215
54 t.boolean "markdowned"
54 t.boolean "markdowned"
55 - t.datetime "created_at", :null => false
55 + t.datetime "created_at", :null => false
56 - t.datetime "updated_at", :null => false
56 + t.datetime "updated_at", :null => false
57 end
57 end
58
58
59 create_table "grader_configurations", :force => true do |t|
59 create_table "grader_configurations", :force => true do |t|
60 t.string "key"
60 t.string "key"
61 t.string "value_type"
61 t.string "value_type"
62 t.string "value"
62 t.string "value"
63 - t.datetime "created_at", :null => false
63 + t.datetime "created_at", :null => false
64 - t.datetime "updated_at", :null => false
64 + t.datetime "updated_at", :null => false
65 - t.text "description"
65 + t.text "description", :limit => 16777215
66 end
66 end
67
67
68 create_table "grader_processes", :force => true do |t|
68 create_table "grader_processes", :force => true do |t|
69 t.string "host", :limit => 20
69 t.string "host", :limit => 20
70 t.integer "pid"
70 t.integer "pid"
71 t.string "mode"
71 t.string "mode"
72 t.boolean "active"
72 t.boolean "active"
73 t.datetime "created_at", :null => false
73 t.datetime "created_at", :null => false
74 t.datetime "updated_at", :null => false
74 t.datetime "updated_at", :null => false
75 t.integer "task_id"
75 t.integer "task_id"
76 t.string "task_type"
76 t.string "task_type"
77 t.boolean "terminated"
77 t.boolean "terminated"
78 end
78 end
79
79
80 add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid"
80 add_index "grader_processes", ["host", "pid"], :name => "index_grader_processes_on_ip_and_pid"
81
81
82 create_table "languages", :force => true do |t|
82 create_table "languages", :force => true do |t|
83 t.string "name", :limit => 10
83 t.string "name", :limit => 10
84 t.string "pretty_name"
84 t.string "pretty_name"
85 t.string "ext", :limit => 10
85 t.string "ext", :limit => 10
86 t.string "common_ext"
86 t.string "common_ext"
87 end
87 end
88
88
89 create_table "logins", :force => true do |t|
89 create_table "logins", :force => true do |t|
90 t.integer "user_id"
90 t.integer "user_id"
91 t.string "ip_address"
91 t.string "ip_address"
92 t.datetime "created_at", :null => false
92 t.datetime "created_at", :null => false
93 t.datetime "updated_at", :null => false
93 t.datetime "updated_at", :null => false
94 end
94 end
95
95
96 create_table "messages", :force => true do |t|
96 create_table "messages", :force => true do |t|
97 t.integer "sender_id"
97 t.integer "sender_id"
98 t.integer "receiver_id"
98 t.integer "receiver_id"
99 t.integer "replying_message_id"
99 t.integer "replying_message_id"
100 - t.text "body"
100 + t.text "body", :limit => 16777215
101 t.boolean "replied"
101 t.boolean "replied"
102 - t.datetime "created_at", :null => false
102 + t.datetime "created_at", :null => false
103 - t.datetime "updated_at", :null => false
103 + t.datetime "updated_at", :null => false
104 end
104 end
105
105
106 create_table "problems", :force => true do |t|
106 create_table "problems", :force => true do |t|
107 t.string "name", :limit => 30
107 t.string "name", :limit => 30
108 t.string "full_name"
108 t.string "full_name"
109 t.integer "full_score"
109 t.integer "full_score"
110 t.date "date_added"
110 t.date "date_added"
111 t.boolean "available"
111 t.boolean "available"
112 t.string "url"
112 t.string "url"
113 t.integer "description_id"
113 t.integer "description_id"
114 t.boolean "test_allowed"
114 t.boolean "test_allowed"
115 t.boolean "output_only"
115 t.boolean "output_only"
116 t.string "description_filename"
116 t.string "description_filename"
117 end
117 end
118
118
119 create_table "rights", :force => true do |t|
119 create_table "rights", :force => true do |t|
120 t.string "name"
120 t.string "name"
121 t.string "controller"
121 t.string "controller"
122 t.string "action"
122 t.string "action"
123 end
123 end
124
124
125 create_table "rights_roles", :id => false, :force => true do |t|
125 create_table "rights_roles", :id => false, :force => true do |t|
126 t.integer "right_id"
126 t.integer "right_id"
127 t.integer "role_id"
127 t.integer "role_id"
128 end
128 end
129
129
130 add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id"
130 add_index "rights_roles", ["role_id"], :name => "index_rights_roles_on_role_id"
131
131
132 create_table "roles", :force => true do |t|
132 create_table "roles", :force => true do |t|
133 t.string "name"
133 t.string "name"
134 end
134 end
135
135
136 create_table "roles_users", :id => false, :force => true do |t|
136 create_table "roles_users", :id => false, :force => true do |t|
137 t.integer "role_id"
137 t.integer "role_id"
138 t.integer "user_id"
138 t.integer "user_id"
139 end
139 end
140
140
141 add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id"
141 add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id"
142
142
143 create_table "sessions", :force => true do |t|
143 create_table "sessions", :force => true do |t|
144 t.string "session_id"
144 t.string "session_id"
145 - t.text "data"
145 + t.text "data", :limit => 16777215
146 t.datetime "updated_at"
146 t.datetime "updated_at"
147 end
147 end
148
148
149 add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
149 add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
150 add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
150 add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
151
151
152 create_table "sites", :force => true do |t|
152 create_table "sites", :force => true do |t|
153 t.string "name"
153 t.string "name"
154 t.boolean "started"
154 t.boolean "started"
155 t.datetime "start_time"
155 t.datetime "start_time"
156 t.datetime "created_at", :null => false
156 t.datetime "created_at", :null => false
157 t.datetime "updated_at", :null => false
157 t.datetime "updated_at", :null => false
158 t.integer "country_id"
158 t.integer "country_id"
159 t.string "password"
159 t.string "password"
160 end
160 end
161
161
162 + create_table "submission_view_logs", :force => true do |t|
163 + t.integer "user_id"
164 + t.integer "submission_id"
165 + t.datetime "created_at", :null => false
166 + t.datetime "updated_at", :null => false
167 + end
168 +
162 create_table "submissions", :force => true do |t|
169 create_table "submissions", :force => true do |t|
163 t.integer "user_id"
170 t.integer "user_id"
164 t.integer "problem_id"
171 t.integer "problem_id"
165 t.integer "language_id"
172 t.integer "language_id"
166 - t.text "source"
173 + t.text "source", :limit => 16777215
167 t.binary "binary"
174 t.binary "binary"
168 t.datetime "submitted_at"
175 t.datetime "submitted_at"
169 t.datetime "compiled_at"
176 t.datetime "compiled_at"
170 - t.text "compiler_message"
177 + t.text "compiler_message", :limit => 16777215
171 t.datetime "graded_at"
178 t.datetime "graded_at"
172 t.integer "points"
179 t.integer "points"
173 - t.text "grader_comment"
180 + t.text "grader_comment", :limit => 16777215
174 t.integer "number"
181 t.integer "number"
175 t.string "source_filename"
182 t.string "source_filename"
176 t.float "max_runtime"
183 t.float "max_runtime"
177 t.integer "peak_memory"
184 t.integer "peak_memory"
178 t.integer "effective_code_length"
185 t.integer "effective_code_length"
179 t.string "ip_address"
186 t.string "ip_address"
180 end
187 end
181
188
182 add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true
189 add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true
183 add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id"
190 add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id"
184
191
185 create_table "tasks", :force => true do |t|
192 create_table "tasks", :force => true do |t|
186 t.integer "submission_id"
193 t.integer "submission_id"
187 t.datetime "created_at"
194 t.datetime "created_at"
188 t.integer "status"
195 t.integer "status"
189 t.datetime "updated_at"
196 t.datetime "updated_at"
190 end
197 end
191
198
192 create_table "test_pairs", :force => true do |t|
199 create_table "test_pairs", :force => true do |t|
193 t.integer "problem_id"
200 t.integer "problem_id"
194 - t.text "input", :limit => 16777215
201 + t.text "input", :limit => 2147483647
195 - t.text "solution", :limit => 16777215
202 + t.text "solution", :limit => 2147483647
196 - t.datetime "created_at", :null => false
203 + t.datetime "created_at", :null => false
197 - t.datetime "updated_at", :null => false
204 + t.datetime "updated_at", :null => false
198 end
205 end
199
206
200 create_table "test_requests", :force => true do |t|
207 create_table "test_requests", :force => true do |t|
201 t.integer "user_id"
208 t.integer "user_id"
202 t.integer "problem_id"
209 t.integer "problem_id"
203 t.integer "submission_id"
210 t.integer "submission_id"
204 t.string "input_file_name"
211 t.string "input_file_name"
205 t.string "output_file_name"
212 t.string "output_file_name"
206 t.string "running_stat"
213 t.string "running_stat"
207 t.integer "status"
214 t.integer "status"
208 - t.datetime "updated_at", :null => false
215 + t.datetime "updated_at", :null => false
209 t.datetime "submitted_at"
216 t.datetime "submitted_at"
210 t.datetime "compiled_at"
217 t.datetime "compiled_at"
211 - t.text "compiler_message"
218 + t.text "compiler_message", :limit => 16777215
212 t.datetime "graded_at"
219 t.datetime "graded_at"
213 t.string "grader_comment"
220 t.string "grader_comment"
214 - t.datetime "created_at", :null => false
221 + t.datetime "created_at", :null => false
215 t.float "running_time"
222 t.float "running_time"
216 t.string "exit_status"
223 t.string "exit_status"
217 t.integer "memory_usage"
224 t.integer "memory_usage"
218 end
225 end
219
226
220 add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id"
227 add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id"
221
228
222 create_table "user_contest_stats", :force => true do |t|
229 create_table "user_contest_stats", :force => true do |t|
223 t.integer "user_id"
230 t.integer "user_id"
224 t.datetime "started_at"
231 t.datetime "started_at"
225 t.datetime "created_at", :null => false
232 t.datetime "created_at", :null => false
226 t.datetime "updated_at", :null => false
233 t.datetime "updated_at", :null => false
227 t.boolean "forced_logout"
234 t.boolean "forced_logout"
228 end
235 end
229
236
230 create_table "users", :force => true do |t|
237 create_table "users", :force => true do |t|
231 t.string "login", :limit => 50
238 t.string "login", :limit => 50
232 t.string "full_name"
239 t.string "full_name"
233 t.string "hashed_password"
240 t.string "hashed_password"
234 t.string "salt", :limit => 5
241 t.string "salt", :limit => 5
235 t.string "alias"
242 t.string "alias"
236 t.string "email"
243 t.string "email"
237 t.integer "site_id"
244 t.integer "site_id"
238 t.integer "country_id"
245 t.integer "country_id"
239 t.boolean "activated", :default => false
246 t.boolean "activated", :default => false
240 t.datetime "created_at"
247 t.datetime "created_at"
241 t.datetime "updated_at"
248 t.datetime "updated_at"
249 + t.string "section"
242 t.boolean "enabled", :default => true
250 t.boolean "enabled", :default => true
243 t.string "remark"
251 t.string "remark"
244 - t.string "last_ip"
245 end
252 end
246
253
247 add_index "users", ["login"], :name => "index_users_on_login", :unique => true
254 add_index "users", ["login"], :name => "index_users_on_login", :unique => true
248
255
249 end
256 end
You need to be logged in to leave comments. Login now