Description:
merge with algo-bm
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r532:e19c25c6b241 - - 13 files changed: 122 inserted, 6 deleted
@@ -0,0 +1,3 | |||
|
1 | + class SubmissionViewLog < 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 | + class AddLastIpToUser < ActiveRecord::Migration | |
|
2 | + def change | |
|
3 | + add_column :users, :last_ip, :string | |
|
4 | + end | |
|
5 | + 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 |
@@ -57,49 +57,49 | |||
|
57 | 57 | hike (1.2.3) |
|
58 | 58 | i18n (0.7.0) |
|
59 | 59 | in_place_editing (1.2.0) |
|
60 | 60 | journey (1.0.4) |
|
61 | 61 | jquery-rails (3.1.2) |
|
62 | 62 | railties (>= 3.0, < 5.0) |
|
63 | 63 | thor (>= 0.14, < 2.0) |
|
64 | 64 | jquery-tablesorter (1.13.4) |
|
65 | 65 | railties (>= 3.1, < 5) |
|
66 | 66 | jquery-timepicker-addon-rails (1.4.1) |
|
67 | 67 | railties (>= 3.1) |
|
68 | 68 | jquery-ui-rails (4.0.3) |
|
69 | 69 | jquery-rails |
|
70 | 70 | railties (>= 3.1.0) |
|
71 | 71 | jquery-ui-sass-rails (4.0.3.0) |
|
72 | 72 | jquery-rails |
|
73 | 73 | jquery-ui-rails (= 4.0.3) |
|
74 | 74 | railties (>= 3.1.0) |
|
75 | 75 | json (1.8.2) |
|
76 | 76 | mail (2.5.4) |
|
77 | 77 | mime-types (~> 1.16) |
|
78 | 78 | treetop (~> 1.4.8) |
|
79 | 79 | mime-types (1.25.1) |
|
80 | 80 | multi_json (1.10.1) |
|
81 |
- mysql2 (0.3. |
|
|
81 | + mysql2 (0.3.20) | |
|
82 | 82 | polyglot (0.3.5) |
|
83 | 83 | power_assert (0.2.2) |
|
84 | 84 | prototype-rails (3.2.1) |
|
85 | 85 | rails (~> 3.2) |
|
86 | 86 | rack (1.4.5) |
|
87 | 87 | rack-cache (1.2) |
|
88 | 88 | rack (>= 0.4) |
|
89 | 89 | rack-ssl (1.3.4) |
|
90 | 90 | rack |
|
91 | 91 | rack-test (0.6.3) |
|
92 | 92 | rack (>= 1.0) |
|
93 | 93 | rails (3.2.21) |
|
94 | 94 | actionmailer (= 3.2.21) |
|
95 | 95 | actionpack (= 3.2.21) |
|
96 | 96 | activerecord (= 3.2.21) |
|
97 | 97 | activeresource (= 3.2.21) |
|
98 | 98 | activesupport (= 3.2.21) |
|
99 | 99 | bundler (~> 1.0) |
|
100 | 100 | railties (= 3.2.21) |
|
101 | 101 | railties (3.2.21) |
|
102 | 102 | actionpack (= 3.2.21) |
|
103 | 103 | activesupport (= 3.2.21) |
|
104 | 104 | rack-ssl (~> 1.3.2) |
|
105 | 105 | rake (>= 0.8.7) |
@@ -1,29 +1,29 | |||
|
1 | 1 | class ConfigurationsController < ApplicationController |
|
2 | 2 | |
|
3 | 3 | before_filter :authenticate |
|
4 | 4 | before_filter { |controller| controller.authorization_by_roles(['admin'])} |
|
5 | 5 | |
|
6 | 6 | |
|
7 | 7 | def index |
|
8 | 8 | @configurations = GraderConfiguration.find(:all, |
|
9 | 9 | :order => '`key`') |
|
10 | 10 | end |
|
11 | 11 | |
|
12 | 12 | def reload |
|
13 | 13 | GraderConfiguration.reload |
|
14 | 14 | redirect_to :action => 'index' |
|
15 | 15 | end |
|
16 | 16 | |
|
17 | 17 | def update |
|
18 | 18 | @config = GraderConfiguration.find(params[:id]) |
|
19 |
- User.clear_last_login if @config.key = |
|
|
19 | + User.clear_last_login if @config.key == GraderConfiguration::MULTIPLE_IP_LOGIN_KEY and @config.value == 'true' and params[:grader_configuration][:value] == 'false' | |
|
20 | 20 | respond_to do |format| |
|
21 | 21 | if @config.update_attributes(params[:grader_configuration]) |
|
22 | 22 | format.json { head :ok } |
|
23 | 23 | else |
|
24 | 24 | format.json { respond_with_bip(@config) } |
|
25 | 25 | end |
|
26 | 26 | end |
|
27 | 27 | end |
|
28 | 28 | |
|
29 | 29 | end |
@@ -65,48 +65,51 | |||
|
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 | + user = User.find(session[:user_id]) | |
|
90 | + SubmissionViewLog.create(user_id: session[:user_id],submission_id: @submission.id) unless user.admin? | |
|
91 | + | |
|
89 | 92 | end |
|
90 | 93 | |
|
91 | 94 | # various grader controls |
|
92 | 95 | |
|
93 | 96 | def stop |
|
94 | 97 | grader_proc = GraderProcess.find(params[:id]) |
|
95 | 98 | GraderScript.stop_grader(grader_proc.pid) |
|
96 | 99 | flash[:notice] = 'Grader stopped. It may not disappear now, but it should disappear shortly.' |
|
97 | 100 | redirect_to :action => 'list' |
|
98 | 101 | end |
|
99 | 102 | |
|
100 | 103 | def stop_all |
|
101 | 104 | GraderScript.stop_graders(GraderProcess.find_running_graders + |
|
102 | 105 | GraderProcess.find_stalled_process) |
|
103 | 106 | flash[:notice] = 'Graders stopped. They may not disappear now, but they should disappear shortly.' |
|
104 | 107 | redirect_to :action => 'list' |
|
105 | 108 | end |
|
106 | 109 | |
|
107 | 110 | def start_grading |
|
108 | 111 | GraderScript.start_grader('grading') |
|
109 | 112 | flash[:notice] = '2 graders in grading env started, one for grading queue tasks, another for grading test request' |
|
110 | 113 | redirect_to :action => 'list' |
|
111 | 114 | end |
|
112 | 115 |
@@ -142,49 +142,49 | |||
|
142 | 142 | def turn_all_on |
|
143 | 143 | Problem.find(:all, |
|
144 | 144 | :conditions => "available = 0").each do |problem| |
|
145 | 145 | problem.available = true |
|
146 | 146 | problem.save |
|
147 | 147 | end |
|
148 | 148 | redirect_to :action => 'list' |
|
149 | 149 | end |
|
150 | 150 | |
|
151 | 151 | def stat |
|
152 | 152 | @problem = Problem.find(params[:id]) |
|
153 | 153 | unless @problem.available or session[:admin] |
|
154 | 154 | redirect_to :controller => 'main', :action => 'list' |
|
155 | 155 | return |
|
156 | 156 | end |
|
157 | 157 | @submissions = Submission.includes(:user).where(problem_id: params[:id]).order(:user_id,:id) |
|
158 | 158 | |
|
159 | 159 | #stat summary |
|
160 | 160 | range =65 |
|
161 | 161 | @histogram = { data: Array.new(range,0), summary: {} } |
|
162 | 162 | user = Hash.new(0) |
|
163 | 163 | @submissions.find_each do |sub| |
|
164 | 164 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
165 | 165 | @histogram[:data][d.to_i] += 1 if d < range |
|
166 | - user[sub.user_id] = [user[sub.user_id], (sub.try(:points) >= @problem.full_score) ? 1 : 0].max | |
|
166 | + user[sub.user_id] = [user[sub.user_id], ((sub.try(:points) || 0) >= @problem.full_score) ? 1 : 0].max | |
|
167 | 167 | end |
|
168 | 168 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
169 | 169 | |
|
170 | 170 | @summary = { attempt: user.count, solve: 0 } |
|
171 | 171 | user.each_value { |v| @summary[:solve] += 1 if v == 1 } |
|
172 | 172 | end |
|
173 | 173 | |
|
174 | 174 | def manage |
|
175 | 175 | @problems = Problem.find(:all, :order => 'date_added DESC') |
|
176 | 176 | end |
|
177 | 177 | |
|
178 | 178 | def do_manage |
|
179 | 179 | if params.has_key? 'change_date_added' |
|
180 | 180 | change_date_added |
|
181 | 181 | elsif params.has_key? 'add_to_contest' |
|
182 | 182 | add_to_contest |
|
183 | 183 | elsif params.has_key? 'enable_problem' |
|
184 | 184 | set_available(true) |
|
185 | 185 | elsif params.has_key? 'disable_problem' |
|
186 | 186 | set_available(false) |
|
187 | 187 | end |
|
188 | 188 | redirect_to :action => 'manage' |
|
189 | 189 | end |
|
190 | 190 |
@@ -104,49 +104,49 | |||
|
104 | 104 | flash[:notice] = 'New password has been mailed to you.' |
|
105 | 105 | end |
|
106 | 106 | else |
|
107 | 107 | flash[:notice] = I18n.t 'registration.password_retrieval.no_email' |
|
108 | 108 | end |
|
109 | 109 | redirect_to :action => 'forget' |
|
110 | 110 | end |
|
111 | 111 | |
|
112 | 112 | def profile |
|
113 | 113 | @user = User.find(params[:id]) |
|
114 | 114 | @submission = Submission.includes(:problem).where(user_id: params[:id]) |
|
115 | 115 | |
|
116 | 116 | range = 120 |
|
117 | 117 | @histogram = { data: Array.new(range,0), summary: {} } |
|
118 | 118 | @summary = {count: 0, solve: 0, attempt: 0} |
|
119 | 119 | problem = Hash.new(0) |
|
120 | 120 | |
|
121 | 121 | @submission.find_each do |sub| |
|
122 | 122 | #histogram |
|
123 | 123 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
124 | 124 | @histogram[:data][d.to_i] += 1 if d < range |
|
125 | 125 | |
|
126 | 126 | @summary[:count] += 1 |
|
127 | 127 | next unless sub.problem |
|
128 | - problem[sub.problem] = [problem[sub.problem], (sub.points >= sub.problem.full_score) ? 1 : 0].max | |
|
128 | + problem[sub.problem] = [problem[sub.problem], ( (sub.try(:points) || 0) >= sub.problem.full_score) ? 1 : 0].max | |
|
129 | 129 | end |
|
130 | 130 | |
|
131 | 131 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
132 | 132 | @summary[:attempt] = problem.count |
|
133 | 133 | problem.each_value { |v| @summary[:solve] += 1 if v == 1 } |
|
134 | 134 | end |
|
135 | 135 | |
|
136 | 136 | protected |
|
137 | 137 | |
|
138 | 138 | def verify_online_registration |
|
139 | 139 | if !GraderConfiguration['system.online_registration'] |
|
140 | 140 | redirect_to :controller => 'main', :action => 'login' |
|
141 | 141 | end |
|
142 | 142 | end |
|
143 | 143 | |
|
144 | 144 | def send_confirmation_email(user) |
|
145 | 145 | contest_name = GraderConfiguration['contest.name'] |
|
146 | 146 | activation_url = url_for(:action => 'confirm', |
|
147 | 147 | :login => user.login, |
|
148 | 148 | :activation => user.activation_key) |
|
149 | 149 | home_url = url_for(:controller => 'main', :action => 'index') |
|
150 | 150 | mail_subject = "[#{contest_name}] Confirmation" |
|
151 | 151 | mail_body = t('registration.email_body', { |
|
152 | 152 | :full_name => user.full_name, |
@@ -1,35 +1,36 | |||
|
1 | 1 | require 'yaml' |
|
2 | 2 | |
|
3 | 3 | # |
|
4 | 4 | # This class also contains various login of the system. |
|
5 | 5 | # |
|
6 | 6 | class GraderConfiguration < ActiveRecord::Base |
|
7 | 7 | |
|
8 | 8 | SYSTEM_MODE_CONF_KEY = 'system.mode' |
|
9 | 9 | TEST_REQUEST_EARLY_TIMEOUT_KEY = 'contest.test_request.early_timeout' |
|
10 | 10 | MULTICONTESTS_KEY = 'system.multicontests' |
|
11 | 11 | CONTEST_TIME_LIMIT_KEY = 'contest.time_limit' |
|
12 | + MULTIPLE_IP_LOGIN_KEY = 'right.multiple_ip_login' | |
|
12 | 13 | |
|
13 | 14 | cattr_accessor :config_cache |
|
14 | 15 | cattr_accessor :task_grading_info_cache |
|
15 | 16 | cattr_accessor :contest_time_str |
|
16 | 17 | cattr_accessor :contest_time |
|
17 | 18 | |
|
18 | 19 | GraderConfiguration.config_cache = nil |
|
19 | 20 | GraderConfiguration.task_grading_info_cache = nil |
|
20 | 21 | |
|
21 | 22 | def self.config_cached? |
|
22 | 23 | (defined? CONFIGURATION_CACHE_ENABLED) and (CONFIGURATION_CACHE_ENABLED) |
|
23 | 24 | end |
|
24 | 25 | |
|
25 | 26 | def self.get(key) |
|
26 | 27 | if GraderConfiguration.config_cached? |
|
27 | 28 | if GraderConfiguration.config_cache == nil |
|
28 | 29 | self.read_config |
|
29 | 30 | end |
|
30 | 31 | return GraderConfiguration.config_cache[key] |
|
31 | 32 | else |
|
32 | 33 | return GraderConfiguration.read_one_key(key) |
|
33 | 34 | end |
|
34 | 35 | end |
|
35 | 36 |
@@ -37,30 +37,30 | |||
|
37 | 37 | |
|
38 | 38 | |
|
39 | 39 | %table.tablesorter-cafe#submission_table |
|
40 | 40 | %thead |
|
41 | 41 | %tr |
|
42 | 42 | %th ID |
|
43 | 43 | %th Problem code |
|
44 | 44 | %th Problem full name |
|
45 | 45 | %th Language |
|
46 | 46 | %th Submitted at |
|
47 | 47 | %th Result |
|
48 | 48 | %th Score |
|
49 | 49 | - if session[:admin] |
|
50 | 50 | %th IP |
|
51 | 51 | %tbody |
|
52 | 52 | - @submission.each do |s| |
|
53 | 53 | - next unless s.problem |
|
54 | 54 | %tr |
|
55 | 55 | %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id |
|
56 | 56 | %td= link_to s.problem.name, controller: "problems", action: "stat", id: s.problem |
|
57 | 57 | %td= s.problem.full_name |
|
58 | 58 | %td= s.language.pretty_name |
|
59 | 59 | %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) |
|
60 | 60 | %td.fix-width= s.grader_comment |
|
61 |
- %td= (s.points*100 |
|
|
61 | + %td= ( s.try(:points) ? (s.points*100/s.problem.full_score) : '' ) | |
|
62 | 62 | - if session[:admin] |
|
63 | 63 | %td= s.ip_address |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 |
@@ -1,38 +1,38 | |||
|
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 => 20150 |
|
|
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" |
@@ -138,48 +138,55 | |||
|
138 | 138 | t.integer "user_id" |
|
139 | 139 | end |
|
140 | 140 | |
|
141 | 141 | add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" |
|
142 | 142 | |
|
143 | 143 | create_table "sessions", :force => true do |t| |
|
144 | 144 | t.string "session_id" |
|
145 | 145 | t.text "data", :limit => 16777215 |
|
146 | 146 | t.datetime "updated_at" |
|
147 | 147 | end |
|
148 | 148 | |
|
149 | 149 | add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" |
|
150 | 150 | add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" |
|
151 | 151 | |
|
152 | 152 | create_table "sites", :force => true do |t| |
|
153 | 153 | t.string "name" |
|
154 | 154 | t.boolean "started" |
|
155 | 155 | t.datetime "start_time" |
|
156 | 156 | t.datetime "created_at", :null => false |
|
157 | 157 | t.datetime "updated_at", :null => false |
|
158 | 158 | t.integer "country_id" |
|
159 | 159 | t.string "password" |
|
160 | 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 | 169 | create_table "submissions", :force => true do |t| |
|
163 | 170 | t.integer "user_id" |
|
164 | 171 | t.integer "problem_id" |
|
165 | 172 | t.integer "language_id" |
|
166 | 173 | t.text "source", :limit => 16777215 |
|
167 | 174 | t.binary "binary" |
|
168 | 175 | t.datetime "submitted_at" |
|
169 | 176 | t.datetime "compiled_at" |
|
170 | 177 | t.text "compiler_message", :limit => 16777215 |
|
171 | 178 | t.datetime "graded_at" |
|
172 | 179 | t.integer "points" |
|
173 | 180 | t.text "grader_comment", :limit => 16777215 |
|
174 | 181 | t.integer "number" |
|
175 | 182 | t.string "source_filename" |
|
176 | 183 | t.float "max_runtime" |
|
177 | 184 | t.integer "peak_memory" |
|
178 | 185 | t.integer "effective_code_length" |
|
179 | 186 | t.string "ip_address" |
|
180 | 187 | end |
|
181 | 188 | |
|
182 | 189 | add_index "submissions", ["user_id", "problem_id", "number"], :name => "index_submissions_on_user_id_and_problem_id_and_number", :unique => true |
|
183 | 190 | add_index "submissions", ["user_id", "problem_id"], :name => "index_submissions_on_user_id_and_problem_id" |
|
184 | 191 | |
|
185 | 192 | create_table "tasks", :force => true do |t| |
You need to be logged in to leave comments.
Login now