Description:
fix compiler message
add testing database
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r621:3b5645cfc80e - - 9 files changed: 130 inserted, 111 deleted
@@ -1,72 +1,73 | |||||
|
1 | source 'https://rubygems.org' |
|
1 | source 'https://rubygems.org' |
|
2 |
|
2 | ||
|
3 | gem 'rails', '~>4.2.0' |
|
3 | gem 'rails', '~>4.2.0' |
|
4 | gem 'activerecord-session_store' |
|
4 | gem 'activerecord-session_store' |
|
5 |
|
5 | ||
|
6 | gem 'select2-rails' |
|
6 | gem 'select2-rails' |
|
7 |
|
7 | ||
|
8 | # Bundle edge Rails instead: |
|
8 | # Bundle edge Rails instead: |
|
9 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
|
9 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
|
10 |
|
10 | ||
|
11 | gem 'mysql2' |
|
11 | gem 'mysql2' |
|
|
12 | + gem 'sqlite3' | ||
|
12 |
|
13 | ||
|
13 | # Gems used only for assets and not required |
|
14 | # Gems used only for assets and not required |
|
14 | # in production environments by default. |
|
15 | # in production environments by default. |
|
15 | group :assets do |
|
16 | group :assets do |
|
16 | gem 'sass-rails' |
|
17 | gem 'sass-rails' |
|
17 | gem 'coffee-rails' |
|
18 | gem 'coffee-rails' |
|
18 |
|
19 | ||
|
19 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes |
|
20 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes |
|
20 | # gem 'therubyracer', :platforms => :ruby |
|
21 | # gem 'therubyracer', :platforms => :ruby |
|
21 |
|
22 | ||
|
22 | gem 'uglifier' |
|
23 | gem 'uglifier' |
|
23 | end |
|
24 | end |
|
24 |
|
25 | ||
|
25 | # gem 'prototype-rails' |
|
26 | # gem 'prototype-rails' |
|
26 |
|
27 | ||
|
27 | # To use ActiveModel has_secure_password |
|
28 | # To use ActiveModel has_secure_password |
|
28 | # gem 'bcrypt-ruby', '~> 3.0.0' |
|
29 | # gem 'bcrypt-ruby', '~> 3.0.0' |
|
29 |
|
30 | ||
|
30 | # To use Jbuilder templates for JSON |
|
31 | # To use Jbuilder templates for JSON |
|
31 | # gem 'jbuilder' |
|
32 | # gem 'jbuilder' |
|
32 |
|
33 | ||
|
33 | # Use unicorn as the app server |
|
34 | # Use unicorn as the app server |
|
34 | # gem 'unicorn' |
|
35 | # gem 'unicorn' |
|
35 |
|
36 | ||
|
36 | # Deploy with Capistrano |
|
37 | # Deploy with Capistrano |
|
37 | # gem 'capistrano' |
|
38 | # gem 'capistrano' |
|
38 |
|
39 | ||
|
39 | # To use debugger |
|
40 | # To use debugger |
|
40 | # gem 'debugger' |
|
41 | # gem 'debugger' |
|
41 | # |
|
42 | # |
|
42 |
|
43 | ||
|
43 | #in-place editor |
|
44 | #in-place editor |
|
44 | gem 'best_in_place', '~> 3.0.1' |
|
45 | gem 'best_in_place', '~> 3.0.1' |
|
45 |
|
46 | ||
|
46 | # jquery addition |
|
47 | # jquery addition |
|
47 | gem 'jquery-rails' |
|
48 | gem 'jquery-rails' |
|
48 |
- gem 'jquery-ui- |
|
49 | + gem 'jquery-ui-rails' |
|
49 | gem 'jquery-timepicker-addon-rails' |
|
50 | gem 'jquery-timepicker-addon-rails' |
|
50 | gem 'jquery-tablesorter' |
|
51 | gem 'jquery-tablesorter' |
|
51 | gem 'jquery-countdown-rails' |
|
52 | gem 'jquery-countdown-rails' |
|
52 |
|
53 | ||
|
53 | #syntax highlighter |
|
54 | #syntax highlighter |
|
54 | gem 'rouge' |
|
55 | gem 'rouge' |
|
55 |
|
56 | ||
|
56 | #add bootstrap |
|
57 | #add bootstrap |
|
57 | gem 'bootstrap-sass', '~> 3.2.0' |
|
58 | gem 'bootstrap-sass', '~> 3.2.0' |
|
58 | gem 'bootstrap-switch-rails' |
|
59 | gem 'bootstrap-switch-rails' |
|
59 | gem 'bootstrap-toggle-rails' |
|
60 | gem 'bootstrap-toggle-rails' |
|
60 | gem 'autoprefixer-rails' |
|
61 | gem 'autoprefixer-rails' |
|
61 |
|
62 | ||
|
62 | #bootstrap sortable |
|
63 | #bootstrap sortable |
|
63 | gem 'momentjs-rails' |
|
64 | gem 'momentjs-rails' |
|
64 | gem 'rails_bootstrap_sortable' |
|
65 | gem 'rails_bootstrap_sortable' |
|
65 |
|
66 | ||
|
66 | #ace editor |
|
67 | #ace editor |
|
67 | gem 'ace-rails-ap' |
|
68 | gem 'ace-rails-ap' |
|
68 |
|
69 | ||
|
69 | gem 'haml' |
|
70 | gem 'haml' |
|
70 | gem 'haml-rails' |
|
71 | gem 'haml-rails' |
|
71 | gem 'mail' |
|
72 | gem 'mail' |
|
72 | gem 'rdiscount' |
|
73 | gem 'rdiscount' |
@@ -82,52 +82,48 | |||||
|
82 | actionpack (>= 4.0.1) |
|
82 | actionpack (>= 4.0.1) |
|
83 | activesupport (>= 4.0.1) |
|
83 | activesupport (>= 4.0.1) |
|
84 | haml (>= 4.0.6, < 5.0) |
|
84 | haml (>= 4.0.6, < 5.0) |
|
85 | html2haml (>= 1.0.1) |
|
85 | html2haml (>= 1.0.1) |
|
86 | railties (>= 4.0.1) |
|
86 | railties (>= 4.0.1) |
|
87 | html2haml (2.0.0) |
|
87 | html2haml (2.0.0) |
|
88 | erubis (~> 2.7.0) |
|
88 | erubis (~> 2.7.0) |
|
89 | haml (~> 4.0.0) |
|
89 | haml (~> 4.0.0) |
|
90 | nokogiri (~> 1.6.0) |
|
90 | nokogiri (~> 1.6.0) |
|
91 | ruby_parser (~> 3.5) |
|
91 | ruby_parser (~> 3.5) |
|
92 | i18n (0.7.0) |
|
92 | i18n (0.7.0) |
|
93 | in_place_editing (1.2.0) |
|
93 | in_place_editing (1.2.0) |
|
94 | jquery-countdown-rails (2.0.2) |
|
94 | jquery-countdown-rails (2.0.2) |
|
95 | jquery-rails (4.2.1) |
|
95 | jquery-rails (4.2.1) |
|
96 | rails-dom-testing (>= 1, < 3) |
|
96 | rails-dom-testing (>= 1, < 3) |
|
97 | railties (>= 4.2.0) |
|
97 | railties (>= 4.2.0) |
|
98 | thor (>= 0.14, < 2.0) |
|
98 | thor (>= 0.14, < 2.0) |
|
99 | jquery-tablesorter (1.23.1) |
|
99 | jquery-tablesorter (1.23.1) |
|
100 | railties (>= 3.2, < 6) |
|
100 | railties (>= 3.2, < 6) |
|
101 | jquery-timepicker-addon-rails (1.4.1) |
|
101 | jquery-timepicker-addon-rails (1.4.1) |
|
102 | railties (>= 3.1) |
|
102 | railties (>= 3.1) |
|
103 | jquery-ui-rails (4.0.3) |
|
103 | jquery-ui-rails (4.0.3) |
|
104 | jquery-rails |
|
104 | jquery-rails |
|
105 | railties (>= 3.1.0) |
|
105 | railties (>= 3.1.0) |
|
106 | - jquery-ui-sass-rails (4.0.3.0) |
|
||
|
107 | - jquery-rails |
|
||
|
108 | - jquery-ui-rails (= 4.0.3) |
|
||
|
109 | - railties (>= 3.1.0) |
|
||
|
110 | json (1.8.3) |
|
106 | json (1.8.3) |
|
111 | loofah (2.0.3) |
|
107 | loofah (2.0.3) |
|
112 | nokogiri (>= 1.5.9) |
|
108 | nokogiri (>= 1.5.9) |
|
113 | mail (2.6.4) |
|
109 | mail (2.6.4) |
|
114 | mime-types (>= 1.16, < 4) |
|
110 | mime-types (>= 1.16, < 4) |
|
115 | mime-types (3.1) |
|
111 | mime-types (3.1) |
|
116 | mime-types-data (~> 3.2015) |
|
112 | mime-types-data (~> 3.2015) |
|
117 | mime-types-data (3.2016.0521) |
|
113 | mime-types-data (3.2016.0521) |
|
118 | mini_portile2 (2.1.0) |
|
114 | mini_portile2 (2.1.0) |
|
119 | minitest (5.10.1) |
|
115 | minitest (5.10.1) |
|
120 | momentjs-rails (2.15.1) |
|
116 | momentjs-rails (2.15.1) |
|
121 | railties (>= 3.1) |
|
117 | railties (>= 3.1) |
|
122 | multi_json (1.12.1) |
|
118 | multi_json (1.12.1) |
|
123 | mysql2 (0.4.5) |
|
119 | mysql2 (0.4.5) |
|
124 | nokogiri (1.6.8.1) |
|
120 | nokogiri (1.6.8.1) |
|
125 | mini_portile2 (~> 2.1.0) |
|
121 | mini_portile2 (~> 2.1.0) |
|
126 | power_assert (0.4.1) |
|
122 | power_assert (0.4.1) |
|
127 | rack (1.6.5) |
|
123 | rack (1.6.5) |
|
128 | rack-test (0.6.3) |
|
124 | rack-test (0.6.3) |
|
129 | rack (>= 1.0) |
|
125 | rack (>= 1.0) |
|
130 | rails (4.2.7.1) |
|
126 | rails (4.2.7.1) |
|
131 | actionmailer (= 4.2.7.1) |
|
127 | actionmailer (= 4.2.7.1) |
|
132 | actionpack (= 4.2.7.1) |
|
128 | actionpack (= 4.2.7.1) |
|
133 | actionview (= 4.2.7.1) |
|
129 | actionview (= 4.2.7.1) |
@@ -171,73 +167,75 | |||||
|
171 | rspec-core (~> 3.5.0) |
|
167 | rspec-core (~> 3.5.0) |
|
172 | rspec-expectations (~> 3.5.0) |
|
168 | rspec-expectations (~> 3.5.0) |
|
173 | rspec-mocks (~> 3.5.0) |
|
169 | rspec-mocks (~> 3.5.0) |
|
174 | rspec-support (~> 3.5.0) |
|
170 | rspec-support (~> 3.5.0) |
|
175 | rspec-support (3.5.0) |
|
171 | rspec-support (3.5.0) |
|
176 | ruby_parser (3.8.3) |
|
172 | ruby_parser (3.8.3) |
|
177 | sexp_processor (~> 4.1) |
|
173 | sexp_processor (~> 4.1) |
|
178 | sass (3.4.22) |
|
174 | sass (3.4.22) |
|
179 | sass-rails (5.0.6) |
|
175 | sass-rails (5.0.6) |
|
180 | railties (>= 4.0.0, < 6) |
|
176 | railties (>= 4.0.0, < 6) |
|
181 | sass (~> 3.1) |
|
177 | sass (~> 3.1) |
|
182 | sprockets (>= 2.8, < 4.0) |
|
178 | sprockets (>= 2.8, < 4.0) |
|
183 | sprockets-rails (>= 2.0, < 4.0) |
|
179 | sprockets-rails (>= 2.0, < 4.0) |
|
184 | tilt (>= 1.1, < 3) |
|
180 | tilt (>= 1.1, < 3) |
|
185 | select2-rails (4.0.3) |
|
181 | select2-rails (4.0.3) |
|
186 | thor (~> 0.14) |
|
182 | thor (~> 0.14) |
|
187 | sexp_processor (4.7.0) |
|
183 | sexp_processor (4.7.0) |
|
188 | sprockets (3.7.0) |
|
184 | sprockets (3.7.0) |
|
189 | concurrent-ruby (~> 1.0) |
|
185 | concurrent-ruby (~> 1.0) |
|
190 | rack (> 1, < 3) |
|
186 | rack (> 1, < 3) |
|
191 | sprockets-rails (3.2.0) |
|
187 | sprockets-rails (3.2.0) |
|
192 | actionpack (>= 4.0) |
|
188 | actionpack (>= 4.0) |
|
193 | activesupport (>= 4.0) |
|
189 | activesupport (>= 4.0) |
|
194 | sprockets (>= 3.0.0) |
|
190 | sprockets (>= 3.0.0) |
|
|
191 | + sqlite3 (1.3.12) | ||
|
195 | test-unit (3.2.3) |
|
192 | test-unit (3.2.3) |
|
196 | power_assert |
|
193 | power_assert |
|
197 | thor (0.19.4) |
|
194 | thor (0.19.4) |
|
198 | thread_safe (0.3.5) |
|
195 | thread_safe (0.3.5) |
|
199 | tilt (2.0.5) |
|
196 | tilt (2.0.5) |
|
200 | tzinfo (1.2.2) |
|
197 | tzinfo (1.2.2) |
|
201 | thread_safe (~> 0.1) |
|
198 | thread_safe (~> 0.1) |
|
202 | uglifier (3.0.4) |
|
199 | uglifier (3.0.4) |
|
203 | execjs (>= 0.3.0, < 3) |
|
200 | execjs (>= 0.3.0, < 3) |
|
204 | will_paginate (3.0.12) |
|
201 | will_paginate (3.0.12) |
|
205 |
|
202 | ||
|
206 | PLATFORMS |
|
203 | PLATFORMS |
|
207 | ruby |
|
204 | ruby |
|
208 |
|
205 | ||
|
209 | DEPENDENCIES |
|
206 | DEPENDENCIES |
|
210 | ace-rails-ap |
|
207 | ace-rails-ap |
|
211 | activerecord-session_store |
|
208 | activerecord-session_store |
|
212 | autoprefixer-rails |
|
209 | autoprefixer-rails |
|
213 | best_in_place (~> 3.0.1) |
|
210 | best_in_place (~> 3.0.1) |
|
214 | bootstrap-sass (~> 3.2.0) |
|
211 | bootstrap-sass (~> 3.2.0) |
|
215 | bootstrap-switch-rails |
|
212 | bootstrap-switch-rails |
|
216 | bootstrap-toggle-rails |
|
213 | bootstrap-toggle-rails |
|
217 | coffee-rails |
|
214 | coffee-rails |
|
218 | dynamic_form |
|
215 | dynamic_form |
|
219 | haml |
|
216 | haml |
|
220 | haml-rails |
|
217 | haml-rails |
|
221 | in_place_editing |
|
218 | in_place_editing |
|
222 | jquery-countdown-rails |
|
219 | jquery-countdown-rails |
|
223 | jquery-rails |
|
220 | jquery-rails |
|
224 | jquery-tablesorter |
|
221 | jquery-tablesorter |
|
225 | jquery-timepicker-addon-rails |
|
222 | jquery-timepicker-addon-rails |
|
226 |
- jquery-ui- |
|
223 | + jquery-ui-rails |
|
227 |
|
224 | ||
|
228 | momentjs-rails |
|
225 | momentjs-rails |
|
229 | mysql2 |
|
226 | mysql2 |
|
230 | rails (~> 4.2.0) |
|
227 | rails (~> 4.2.0) |
|
231 | rails_bootstrap_sortable |
|
228 | rails_bootstrap_sortable |
|
232 | rdiscount |
|
229 | rdiscount |
|
233 | rouge |
|
230 | rouge |
|
234 | rspec-rails |
|
231 | rspec-rails |
|
235 | sass-rails |
|
232 | sass-rails |
|
236 | select2-rails |
|
233 | select2-rails |
|
|
234 | + sqlite3 | ||
|
237 | test-unit |
|
235 | test-unit |
|
238 | uglifier |
|
236 | uglifier |
|
239 | verification! |
|
237 | verification! |
|
240 | will_paginate (~> 3.0.7) |
|
238 | will_paginate (~> 3.0.7) |
|
241 |
|
239 | ||
|
242 | BUNDLED WITH |
|
240 | BUNDLED WITH |
|
243 | 1.13.6 |
|
241 | 1.13.6 |
@@ -1,83 +1,96 | |||||
|
1 | class SubmissionsController < ApplicationController |
|
1 | class SubmissionsController < ApplicationController |
|
2 | before_filter :authenticate |
|
2 | before_filter :authenticate |
|
3 | - before_filter :submission_authorization, only: [:show, :direct_edit_submission] |
|
3 | + before_filter :submission_authorization, only: [:show, :direct_edit_submission, :download] |
|
4 |
|
4 | ||
|
5 | # GET /submissions |
|
5 | # GET /submissions |
|
6 | # GET /submissions.json |
|
6 | # GET /submissions.json |
|
7 | # Show problem selection and user's submission of that problem |
|
7 | # Show problem selection and user's submission of that problem |
|
8 | def index |
|
8 | def index |
|
9 | @user = @current_user |
|
9 | @user = @current_user |
|
10 | @problems = @user.available_problems |
|
10 | @problems = @user.available_problems |
|
11 |
|
11 | ||
|
12 | if params[:problem_id]==nil |
|
12 | if params[:problem_id]==nil |
|
13 | @problem = nil |
|
13 | @problem = nil |
|
14 | @submissions = nil |
|
14 | @submissions = nil |
|
15 | else |
|
15 | else |
|
16 | @problem = Problem.find_by_id(params[:problem_id]) |
|
16 | @problem = Problem.find_by_id(params[:problem_id]) |
|
17 | if (@problem == nil) or (not @problem.available) |
|
17 | if (@problem == nil) or (not @problem.available) |
|
18 | redirect_to main_list_path |
|
18 | redirect_to main_list_path |
|
19 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
19 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
20 | return |
|
20 | return |
|
21 | end |
|
21 | end |
|
22 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
22 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
23 | end |
|
23 | end |
|
24 | end |
|
24 | end |
|
25 |
|
25 | ||
|
26 | # GET /submissions/1 |
|
26 | # GET /submissions/1 |
|
27 | # GET /submissions/1.json |
|
27 | # GET /submissions/1.json |
|
28 | def show |
|
28 | def show |
|
29 | @submission = Submission.find(params[:id]) |
|
29 | @submission = Submission.find(params[:id]) |
|
30 |
|
30 | ||
|
31 | #log the viewing |
|
31 | #log the viewing |
|
32 | user = User.find(session[:user_id]) |
|
32 | user = User.find(session[:user_id]) |
|
33 | SubmissionViewLog.create(user_id: session[:user_id],submission_id: @submission.id) unless user.admin? |
|
33 | SubmissionViewLog.create(user_id: session[:user_id],submission_id: @submission.id) unless user.admin? |
|
34 | end |
|
34 | end |
|
35 |
|
35 | ||
|
|
36 | + def download | ||
|
|
37 | + @submission = Submission.find(params[:id]) | ||
|
|
38 | + send_data(@submission.source, {:filename => @submission.download_filename, :type => 'text/plain'}) | ||
|
|
39 | + end | ||
|
|
40 | + | ||
|
|
41 | + def compiler_msg | ||
|
|
42 | + @submission = Submission.find(params[:id]) | ||
|
|
43 | + respond_to do |format| | ||
|
|
44 | + format.js | ||
|
|
45 | + end | ||
|
|
46 | + end | ||
|
|
47 | + | ||
|
36 | #on-site new submission on specific problem |
|
48 | #on-site new submission on specific problem |
|
37 | def direct_edit_problem |
|
49 | def direct_edit_problem |
|
38 | @problem = Problem.find(params[:problem_id]) |
|
50 | @problem = Problem.find(params[:problem_id]) |
|
39 | @source = '' |
|
51 | @source = '' |
|
40 | render 'edit' |
|
52 | render 'edit' |
|
41 | end |
|
53 | end |
|
42 |
|
54 | ||
|
43 | # GET /submissions/1/edit |
|
55 | # GET /submissions/1/edit |
|
44 | def edit |
|
56 | def edit |
|
45 | @submission = Submission.find(params[:id]) |
|
57 | @submission = Submission.find(params[:id]) |
|
46 | @source = @submission.source.to_s |
|
58 | @source = @submission.source.to_s |
|
47 | @problem = @submission.problem |
|
59 | @problem = @submission.problem |
|
48 | @lang_id = @submission.language.id |
|
60 | @lang_id = @submission.language.id |
|
49 | end |
|
61 | end |
|
50 |
|
62 | ||
|
51 |
|
63 | ||
|
52 | def get_latest_submission_status |
|
64 | def get_latest_submission_status |
|
53 | @problem = Problem.find(params[:pid]) |
|
65 | @problem = Problem.find(params[:pid]) |
|
54 | @submission = Submission.find_last_by_user_and_problem(params[:uid],params[:pid]) |
|
66 | @submission = Submission.find_last_by_user_and_problem(params[:uid],params[:pid]) |
|
55 | puts User.find(params[:uid]).login |
|
67 | puts User.find(params[:uid]).login |
|
56 | puts Problem.find(params[:pid]).name |
|
68 | puts Problem.find(params[:pid]).name |
|
57 | puts 'nil' unless @submission |
|
69 | puts 'nil' unless @submission |
|
58 | respond_to do |format| |
|
70 | respond_to do |format| |
|
59 | format.js |
|
71 | format.js |
|
60 | end |
|
72 | end |
|
61 | end |
|
73 | end |
|
62 |
|
74 | ||
|
63 |
|
75 | ||
|
64 | protected |
|
76 | protected |
|
|
77 | + | ||
|
65 | def submission_authorization |
|
78 | def submission_authorization |
|
66 | #admin always has privileged |
|
79 | #admin always has privileged |
|
67 | if @current_user.admin? |
|
80 | if @current_user.admin? |
|
68 | return true |
|
81 | return true |
|
69 | end |
|
82 | end |
|
70 |
|
83 | ||
|
71 | sub = Submission.find(params[:id]) |
|
84 | sub = Submission.find(params[:id]) |
|
72 | if sub.problem.available? |
|
85 | if sub.problem.available? |
|
73 | puts "sub = #{sub.user.id}, current = #{@current_user.id}" |
|
86 | puts "sub = #{sub.user.id}, current = #{@current_user.id}" |
|
74 | return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user |
|
87 | return true if GraderConfiguration["right.user_view_submission"] or sub.user == @current_user |
|
75 | end |
|
88 | end |
|
76 |
|
89 | ||
|
77 | #default to NO |
|
90 | #default to NO |
|
78 | unauthorized_redirect |
|
91 | unauthorized_redirect |
|
79 | return false |
|
92 | return false |
|
80 | end |
|
93 | end |
|
81 |
|
94 | ||
|
82 |
|
95 | ||
|
83 | end |
|
96 | end |
@@ -1,26 +1,26 | |||||
|
1 |
|
1 | ||
|
2 | - if submission.nil? |
|
2 | - if submission.nil? |
|
3 | = "-" |
|
3 | = "-" |
|
4 | - else |
|
4 | - else |
|
5 | - unless submission.graded_at |
|
5 | - unless submission.graded_at |
|
6 | = t 'main.submitted_at' |
|
6 | = t 'main.submitted_at' |
|
7 | = format_short_time(submission.submitted_at.localtime) |
|
7 | = format_short_time(submission.submitted_at.localtime) |
|
8 | - else |
|
8 | - else |
|
9 | - = t 'main.graded_at' |
|
9 | + %strong= t 'main.graded_at' |
|
10 |
- = "#{format_short_time(submission.graded_at.localtime)} |
|
10 | + = "#{format_short_time(submission.graded_at.localtime)} " |
|
|
11 | + %br | ||
|
11 | - if GraderConfiguration['ui.show_score'] |
|
12 | - if GraderConfiguration['ui.show_score'] |
|
12 |
- = |
|
13 | + %strong=t 'main.score' |
|
13 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
14 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
14 | = " [" |
|
15 | = " [" |
|
15 | %tt |
|
16 | %tt |
|
16 | = submission.grader_comment |
|
17 | = submission.grader_comment |
|
17 | = "]" |
|
18 | = "]" |
|
|
19 | + %br | ||
|
|
20 | + %strong View: | ||
|
18 | - if GraderConfiguration.show_grading_result |
|
21 | - if GraderConfiguration.show_grading_result |
|
19 | - = " | " |
|
||
|
20 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
22 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
21 | - = " | " |
|
23 | + = link_to "#{t 'main.cmp_msg'}", {:action => 'compiler_msg', :id => submission.id}, {popup: true,class: 'btn btn-xs btn-info'} |
|
22 | - = link_to("[#{t 'main.cmp_msg'}]", {:action => 'compiler_msg', :id => submission.id}, {:popup => true}) |
|
24 | + = link_to "#{t 'main.src_link'}", download_submission_path(submission.id), class: 'btn btn-xs btn-info' |
|
23 | - = " | " |
|
25 | + = link_to "#{t 'main.submissions_link'}", problem_submissions_path(problem_id), class: 'btn btn-xs btn-info' |
|
24 | - = link_to("[#{t 'main.src_link'}]",{:action => 'source', :id => submission.id}) |
|
26 | + |
|
25 | - //= " | " |
|
||
|
26 | - //= link_to "[#{t 'main.submissions_link'}]", main_submission_path(submission.problem.id) |
|
@@ -1,26 +1,27 | |||||
|
1 |
|
1 | ||
|
2 | - if submission.nil? |
|
2 | - if submission.nil? |
|
3 | = "-" |
|
3 | = "-" |
|
4 | - else |
|
4 | - else |
|
5 | - unless submission.graded_at |
|
5 | - unless submission.graded_at |
|
6 | = t 'main.submitted_at' |
|
6 | = t 'main.submitted_at' |
|
7 | = format_short_time(submission.submitted_at.localtime) |
|
7 | = format_short_time(submission.submitted_at.localtime) |
|
8 | - else |
|
8 | - else |
|
9 | %strong= t 'main.graded_at' |
|
9 | %strong= t 'main.graded_at' |
|
10 | = "#{format_short_time(submission.graded_at.localtime)} " |
|
10 | = "#{format_short_time(submission.graded_at.localtime)} " |
|
11 | %br |
|
11 | %br |
|
12 | - if GraderConfiguration['ui.show_score'] |
|
12 | - if GraderConfiguration['ui.show_score'] |
|
13 | %strong=t 'main.score' |
|
13 | %strong=t 'main.score' |
|
14 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
14 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
15 | = " [" |
|
15 | = " [" |
|
16 | %tt |
|
16 | %tt |
|
17 | = submission.grader_comment |
|
17 | = submission.grader_comment |
|
18 | = "]" |
|
18 | = "]" |
|
19 | %br |
|
19 | %br |
|
20 | %strong View: |
|
20 | %strong View: |
|
21 | - if GraderConfiguration.show_grading_result |
|
21 | - if GraderConfiguration.show_grading_result |
|
22 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
22 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
23 | - = link_to "#{t 'main.cmp_msg'}", {:action => 'compiler_msg', :id => submission.id}, {popup: true,class: 'btn btn-xs btn-info'} |
|
23 | + /= link_to "#{t 'main.cmp_msg'}", {:action => 'compiler_msg', :id => submission.id}, {popup: true,class: 'btn btn-xs btn-info'} |
|
|
24 | + = link_to "#{t 'main.cmp_msg'}", compiler_msg_submission_path(submission.id), {popup: true,remote: true,class: 'btn btn-xs btn-info'} | ||
|
24 | = link_to "#{t 'main.src_link'}",{:action => 'source', :id => submission.id}, class: 'btn btn-xs btn-info' |
|
25 | = link_to "#{t 'main.src_link'}",{:action => 'source', :id => submission.id}, class: 'btn btn-xs btn-info' |
|
25 | = link_to "#{t 'main.submissions_link'}", problem_submissions_path(problem_id), class: 'btn btn-xs btn-info' |
|
26 | = link_to "#{t 'main.submissions_link'}", problem_submissions_path(problem_id), class: 'btn btn-xs btn-info' |
|
26 |
|
27 |
@@ -7,52 +7,53 | |||||
|
7 | .col-md-12 |
|
7 | .col-md-12 |
|
8 | .alert.alert-info |
|
8 | .alert.alert-info |
|
9 | Write your code in the following box, choose language, and click submit button when finished |
|
9 | Write your code in the following box, choose language, and click submit button when finished |
|
10 | .row |
|
10 | .row |
|
11 | .col-md-8 |
|
11 | .col-md-8 |
|
12 | %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'} |
|
12 | %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'} |
|
13 | .col-md-4 |
|
13 | .col-md-4 |
|
14 | = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do |
|
14 | = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do |
|
15 |
|
15 | ||
|
16 | = hidden_field_tag 'editor_text', @source |
|
16 | = hidden_field_tag 'editor_text', @source |
|
17 | = hidden_field_tag 'submission[problem_id]', @problem.id |
|
17 | = hidden_field_tag 'submission[problem_id]', @problem.id |
|
18 | .form-group |
|
18 | .form-group |
|
19 | = label_tag "Task:" |
|
19 | = label_tag "Task:" |
|
20 | = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true |
|
20 | = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true |
|
21 |
|
21 | ||
|
22 | .form-group |
|
22 | .form-group |
|
23 | = label_tag 'Language' |
|
23 | = label_tag 'Language' |
|
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" |
|
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 | .form-group |
|
25 | .form-group |
|
26 | = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit', |
|
26 | = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit', |
|
27 | data: {confirm: "Submitting this source code for task #{@problem.long_name}?"} |
|
27 | data: {confirm: "Submitting this source code for task #{@problem.long_name}?"} |
|
28 | .panel.panel-info |
|
28 | .panel.panel-info |
|
29 | .panel-heading |
|
29 | .panel-heading |
|
30 | Latest Submission Status |
|
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 | .panel-body |
|
32 | .panel-body |
|
32 | - if @submission |
|
33 | - if @submission |
|
33 | = render :partial => 'submission_short', |
|
34 | = render :partial => 'submission_short', |
|
34 |
- :locals => { |
|
35 | + :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id } |
|
35 | .row |
|
36 | .row |
|
36 | .col-md-12 |
|
37 | .col-md-12 |
|
37 | %h2 Console |
|
38 | %h2 Console |
|
38 | %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20} |
|
39 | %textarea#console{style: 'height: 100%; width: 100%;background-color:#000;color:#fff;font-family: consolas, monaco, "Droid Sans Mono";',rows: 20} |
|
39 |
|
40 | ||
|
40 | :javascript |
|
41 | :javascript |
|
41 | $(document).ready(function() { |
|
42 | $(document).ready(function() { |
|
42 | e = ace.edit("editor") |
|
43 | e = ace.edit("editor") |
|
43 | e.setValue($("#text_haha").val()); |
|
44 | e.setValue($("#text_haha").val()); |
|
44 | e.gotoLine(1); |
|
45 | e.gotoLine(1); |
|
45 | $("#language_id").trigger('change'); |
|
46 | $("#language_id").trigger('change'); |
|
46 | brython(); |
|
47 | brython(); |
|
47 | }); |
|
48 | }); |
|
48 |
|
49 | ||
|
49 |
|
50 | ||
|
50 | %script#__main__{type:'text/python3'} |
|
51 | %script#__main__{type:'text/python3'} |
|
51 | :plain |
|
52 | :plain |
|
52 | import sys |
|
53 | import sys |
|
53 | import traceback |
|
54 | import traceback |
|
54 |
|
55 | ||
|
55 | from browser import document as doc |
|
56 | from browser import document as doc |
|
56 | from browser import window, alert, console |
|
57 | from browser import window, alert, console |
|
57 |
|
58 | ||
|
58 | _credits = """ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands |
|
59 | _credits = """ Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands |
@@ -64,40 +64,41 | |||||
|
64 | - else |
|
64 | - else |
|
65 | %td - |
|
65 | %td - |
|
66 | %tr |
|
66 | %tr |
|
67 | %td.text-right |
|
67 | %td.text-right |
|
68 | %strong Points |
|
68 | %strong Points |
|
69 | %td #{@submission.points}/#{@submission.problem.full_score} |
|
69 | %td #{@submission.points}/#{@submission.problem.full_score} |
|
70 | %tr |
|
70 | %tr |
|
71 | %td.text-right |
|
71 | %td.text-right |
|
72 | %strong Comment |
|
72 | %strong Comment |
|
73 | %td #{@submission.grader_comment} |
|
73 | %td #{@submission.grader_comment} |
|
74 | %tr |
|
74 | %tr |
|
75 | %td.text-right |
|
75 | %td.text-right |
|
76 | %strong Runtime (s) |
|
76 | %strong Runtime (s) |
|
77 | %td #{@submission.max_runtime} |
|
77 | %td #{@submission.max_runtime} |
|
78 | %tr |
|
78 | %tr |
|
79 | %td.text-right |
|
79 | %td.text-right |
|
80 | %strong Memory (kb) |
|
80 | %strong Memory (kb) |
|
81 | %td #{@submission.peak_memory} |
|
81 | %td #{@submission.peak_memory} |
|
82 | %tr |
|
82 | %tr |
|
83 | %td.text-right |
|
83 | %td.text-right |
|
84 | %strong Compiler result |
|
84 | %strong Compiler result |
|
85 | %td |
|
85 | %td |
|
86 | %button.btn.btn-info.btn-xs{type: 'button', data: {toggle: 'modal', target: '#compiler'}} |
|
86 | %button.btn.btn-info.btn-xs{type: 'button', data: {toggle: 'modal', target: '#compiler'}} |
|
87 | view |
|
87 | view |
|
88 | - .modal.fade#compiler{tabindex: -1,role: 'dialog'} |
|
||
|
89 | - .modal-dialog.modal-lg{role:'document'} |
|
||
|
90 | - .modal-content |
|
||
|
91 | - .modal-header |
|
||
|
92 | - %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}} |
|
||
|
93 | - %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} × |
|
||
|
94 | - %h4 Compiler message |
|
||
|
95 | - .modal-body |
|
||
|
96 | - %pre= @submission.compiler_message |
|
||
|
97 | - .modal-footer |
|
||
|
98 | - %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close |
|
||
|
99 | - if session[:admin] |
|
88 | - if session[:admin] |
|
100 | %tr |
|
89 | %tr |
|
101 | %td.text-right |
|
90 | %td.text-right |
|
102 | %strong IP |
|
91 | %strong IP |
|
103 | %td #{@submission.ip_address} |
|
92 | %td #{@submission.ip_address} |
|
|
93 | + | ||
|
|
94 | + .modal.fade#compiler{tabindex: -1,role: 'dialog'} | ||
|
|
95 | + .modal-dialog.modal-lg{role:'document'} | ||
|
|
96 | + .modal-content | ||
|
|
97 | + .modal-header | ||
|
|
98 | + %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}} | ||
|
|
99 | + %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} × | ||
|
|
100 | + %h4 Compiler message | ||
|
|
101 | + .modal-body | ||
|
|
102 | + %pre#compiler_msg= @submission.compiler_message | ||
|
|
103 | + .modal-footer | ||
|
|
104 | + %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close |
@@ -16,48 +16,52 | |||||
|
16 | resources :problems do |
|
16 | resources :problems do |
|
17 | member do |
|
17 | member do |
|
18 | get 'toggle' |
|
18 | get 'toggle' |
|
19 | get 'toggle_test' |
|
19 | get 'toggle_test' |
|
20 | get 'stat' |
|
20 | get 'stat' |
|
21 | end |
|
21 | end |
|
22 | collection do |
|
22 | collection do |
|
23 | get 'turn_all_off' |
|
23 | get 'turn_all_off' |
|
24 | get 'turn_all_on' |
|
24 | get 'turn_all_on' |
|
25 | get 'import' |
|
25 | get 'import' |
|
26 | get 'manage' |
|
26 | get 'manage' |
|
27 | end |
|
27 | end |
|
28 | end |
|
28 | end |
|
29 |
|
29 | ||
|
30 | resources :grader_configuration, controller: 'configurations' |
|
30 | resources :grader_configuration, controller: 'configurations' |
|
31 |
|
31 | ||
|
32 | resources :users do |
|
32 | resources :users do |
|
33 | member do |
|
33 | member do |
|
34 | get 'toggle_activate', 'toggle_enable' |
|
34 | get 'toggle_activate', 'toggle_enable' |
|
35 | get 'stat' |
|
35 | get 'stat' |
|
36 | end |
|
36 | end |
|
37 | end |
|
37 | end |
|
38 |
|
38 | ||
|
39 | resources :submissions do |
|
39 | resources :submissions do |
|
|
40 | + member do | ||
|
|
41 | + get 'download' | ||
|
|
42 | + get 'compiler_msg' | ||
|
|
43 | + end | ||
|
40 | collection do |
|
44 | collection do |
|
41 | get 'prob/:problem_id', to: 'submissions#index', as: 'problem' |
|
45 | get 'prob/:problem_id', to: 'submissions#index', as: 'problem' |
|
42 | get 'direct_edit_problem/:problem_id', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem' |
|
46 | get 'direct_edit_problem/:problem_id', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem' |
|
43 | get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status' |
|
47 | get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status' |
|
44 | end |
|
48 | end |
|
45 | end |
|
49 | end |
|
46 |
|
50 | ||
|
47 | get 'tasks/view/:file.:ext' => 'tasks#view' |
|
51 | get 'tasks/view/:file.:ext' => 'tasks#view' |
|
48 | get 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
52 | get 'tasks/download/:id/:file.:ext' => 'tasks#download' |
|
49 | get 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
53 | get 'heartbeat/:id/edit' => 'heartbeat#edit' |
|
50 |
|
54 | ||
|
51 | #main |
|
55 | #main |
|
52 | get "main/list" |
|
56 | get "main/list" |
|
53 | get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission' |
|
57 | get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission' |
|
54 |
|
58 | ||
|
55 | #report |
|
59 | #report |
|
56 | get 'report/current_score', to: 'report#current_score', as: 'report_current_score' |
|
60 | get 'report/current_score', to: 'report#current_score', as: 'report_current_score' |
|
57 | get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
|
61 | get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof' |
|
58 | get "report/login" |
|
62 | get "report/login" |
|
59 | get 'report/max_score', to: 'report#max_score', as: 'report_max_score' |
|
63 | get 'report/max_score', to: 'report#max_score', as: 'report_max_score' |
|
60 | post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score' |
|
64 | post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score' |
|
61 |
|
65 | ||
|
62 | #grader |
|
66 | #grader |
|
63 | get 'graders/list', to: 'graders#list', as: 'grader_list' |
|
67 | get 'graders/list', to: 'graders#list', as: 'grader_list' |
@@ -1,280 +1,280 | |||||
|
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 that you check this file into your version control system. |
|
13 |
|
13 | ||
|
14 |
- ActiveRecord::Schema.define( |
|
14 | + ActiveRecord::Schema.define(version: 20161031063337) do |
|
15 |
|
15 | ||
|
16 |
- create_table "announcements", |
|
16 | + create_table "announcements", force: :cascade do |t| |
|
17 | t.string "author" |
|
17 | t.string "author" |
|
18 | t.text "body" |
|
18 | t.text "body" |
|
19 | t.boolean "published" |
|
19 | t.boolean "published" |
|
20 |
- t.datetime "created_at", |
|
20 | + t.datetime "created_at", null: false |
|
21 |
- t.datetime "updated_at", |
|
21 | + t.datetime "updated_at", null: false |
|
22 |
- t.boolean "frontpage", |
|
22 | + t.boolean "frontpage", default: false |
|
23 |
- t.boolean "contest_only", |
|
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", |
|
28 | + create_table "contests", force: :cascade do |t| |
|
29 | t.string "title" |
|
29 | t.string "title" |
|
30 | t.boolean "enabled" |
|
30 | t.boolean "enabled" |
|
31 |
- t.datetime "created_at", |
|
31 | + t.datetime "created_at", null: false |
|
32 |
- t.datetime "updated_at", |
|
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", |
|
36 | + create_table "contests_problems", id: false, force: :cascade 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", |
|
41 | + create_table "contests_users", id: false, force: :cascade 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", |
|
46 | + create_table "countries", force: :cascade do |t| |
|
47 | t.string "name" |
|
47 | t.string "name" |
|
48 |
- t.datetime "created_at", |
|
48 | + t.datetime "created_at", null: false |
|
49 |
- t.datetime "updated_at", |
|
49 | + t.datetime "updated_at", null: false |
|
50 | end |
|
50 | end |
|
51 |
|
51 | ||
|
52 |
- create_table "descriptions", |
|
52 | + create_table "descriptions", force: :cascade do |t| |
|
53 | t.text "body" |
|
53 | t.text "body" |
|
54 | t.boolean "markdowned" |
|
54 | t.boolean "markdowned" |
|
55 |
- t.datetime "created_at", |
|
55 | + t.datetime "created_at", null: false |
|
56 |
- t.datetime "updated_at", |
|
56 | + t.datetime "updated_at", null: false |
|
57 | end |
|
57 | end |
|
58 |
|
58 | ||
|
59 |
- create_table "grader_configurations", |
|
59 | + create_table "grader_configurations", force: :cascade 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", |
|
63 | + t.datetime "created_at", null: false |
|
64 |
- t.datetime "updated_at", |
|
64 | + t.datetime "updated_at", null: false |
|
65 | t.text "description" |
|
65 | t.text "description" |
|
66 | end |
|
66 | end |
|
67 |
|
67 | ||
|
68 |
- create_table "grader_processes", |
|
68 | + create_table "grader_processes", force: :cascade do |t| |
|
69 | t.string "host" |
|
69 | t.string "host" |
|
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", |
|
73 | + t.datetime "created_at", null: false |
|
74 |
- t.datetime "updated_at", |
|
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"], |
|
80 | + add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid" |
|
81 |
|
81 | ||
|
82 |
- create_table "heart_beats", |
|
82 | + create_table "heart_beats", force: :cascade do |t| |
|
83 | t.integer "user_id" |
|
83 | t.integer "user_id" |
|
84 | t.string "ip_address" |
|
84 | t.string "ip_address" |
|
85 |
- t.datetime "created_at", |
|
85 | + t.datetime "created_at", null: false |
|
86 |
- t.datetime "updated_at", |
|
86 | + t.datetime "updated_at", null: false |
|
87 | t.string "status" |
|
87 | t.string "status" |
|
88 | end |
|
88 | end |
|
89 |
|
89 | ||
|
90 |
- add_index "heart_beats", ["updated_at"], |
|
90 | + add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at" |
|
91 |
|
91 | ||
|
92 |
- create_table "languages", |
|
92 | + create_table "languages", force: :cascade do |t| |
|
93 |
- t.string "name", |
|
93 | + t.string "name", limit: 10 |
|
94 | t.string "pretty_name" |
|
94 | t.string "pretty_name" |
|
95 |
- t.string "ext", |
|
95 | + t.string "ext", limit: 10 |
|
96 | t.string "common_ext" |
|
96 | t.string "common_ext" |
|
97 | end |
|
97 | end |
|
98 |
|
98 | ||
|
99 |
- create_table "logins", |
|
99 | + create_table "logins", force: :cascade do |t| |
|
100 | t.integer "user_id" |
|
100 | t.integer "user_id" |
|
101 | t.string "ip_address" |
|
101 | t.string "ip_address" |
|
102 |
- t.datetime "created_at", |
|
102 | + t.datetime "created_at", null: false |
|
103 |
- t.datetime "updated_at", |
|
103 | + t.datetime "updated_at", null: false |
|
104 | end |
|
104 | end |
|
105 |
|
105 | ||
|
106 |
- create_table "messages", |
|
106 | + create_table "messages", force: :cascade do |t| |
|
107 | t.integer "sender_id" |
|
107 | t.integer "sender_id" |
|
108 | t.integer "receiver_id" |
|
108 | t.integer "receiver_id" |
|
109 | t.integer "replying_message_id" |
|
109 | t.integer "replying_message_id" |
|
110 | t.text "body" |
|
110 | t.text "body" |
|
111 | t.boolean "replied" |
|
111 | t.boolean "replied" |
|
112 |
- t.datetime "created_at", |
|
112 | + t.datetime "created_at", null: false |
|
113 |
- t.datetime "updated_at", |
|
113 | + t.datetime "updated_at", null: false |
|
114 | end |
|
114 | end |
|
115 |
|
115 | ||
|
116 |
- create_table "problems", |
|
116 | + create_table "problems", force: :cascade do |t| |
|
117 |
- t.string "name", |
|
117 | + t.string "name", limit: 30 |
|
118 | t.string "full_name" |
|
118 | t.string "full_name" |
|
119 | t.integer "full_score" |
|
119 | t.integer "full_score" |
|
120 | t.date "date_added" |
|
120 | t.date "date_added" |
|
121 | t.boolean "available" |
|
121 | t.boolean "available" |
|
122 | t.string "url" |
|
122 | t.string "url" |
|
123 | t.integer "description_id" |
|
123 | t.integer "description_id" |
|
124 | t.boolean "test_allowed" |
|
124 | t.boolean "test_allowed" |
|
125 | t.boolean "output_only" |
|
125 | t.boolean "output_only" |
|
126 | t.string "description_filename" |
|
126 | t.string "description_filename" |
|
127 | end |
|
127 | end |
|
128 |
|
128 | ||
|
129 |
- create_table "rights", |
|
129 | + create_table "rights", force: :cascade do |t| |
|
130 | t.string "name" |
|
130 | t.string "name" |
|
131 | t.string "controller" |
|
131 | t.string "controller" |
|
132 | t.string "action" |
|
132 | t.string "action" |
|
133 | end |
|
133 | end |
|
134 |
|
134 | ||
|
135 |
- create_table "rights_roles", |
|
135 | + create_table "rights_roles", id: false, force: :cascade do |t| |
|
136 | t.integer "right_id" |
|
136 | t.integer "right_id" |
|
137 | t.integer "role_id" |
|
137 | t.integer "role_id" |
|
138 | end |
|
138 | end |
|
139 |
|
139 | ||
|
140 |
- add_index "rights_roles", ["role_id"], |
|
140 | + add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id" |
|
141 |
|
141 | ||
|
142 |
- create_table "roles", |
|
142 | + create_table "roles", force: :cascade do |t| |
|
143 | t.string "name" |
|
143 | t.string "name" |
|
144 | end |
|
144 | end |
|
145 |
|
145 | ||
|
146 |
- create_table "roles_users", |
|
146 | + create_table "roles_users", id: false, force: :cascade do |t| |
|
147 | t.integer "role_id" |
|
147 | t.integer "role_id" |
|
148 | t.integer "user_id" |
|
148 | t.integer "user_id" |
|
149 | end |
|
149 | end |
|
150 |
|
150 | ||
|
151 |
- add_index "roles_users", ["user_id"], |
|
151 | + add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id" |
|
152 |
|
152 | ||
|
153 |
- create_table "sessions", |
|
153 | + create_table "sessions", force: :cascade do |t| |
|
154 | t.string "session_id" |
|
154 | t.string "session_id" |
|
155 | t.text "data" |
|
155 | t.text "data" |
|
156 | t.datetime "updated_at" |
|
156 | t.datetime "updated_at" |
|
157 | end |
|
157 | end |
|
158 |
|
158 | ||
|
159 |
- add_index "sessions", ["session_id"], |
|
159 | + add_index "sessions", ["session_id"], name: "index_sessions_on_session_id" |
|
160 |
- add_index "sessions", ["updated_at"], |
|
160 | + add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at" |
|
161 |
|
161 | ||
|
162 |
- create_table "sites", |
|
162 | + create_table "sites", force: :cascade do |t| |
|
163 | t.string "name" |
|
163 | t.string "name" |
|
164 | t.boolean "started" |
|
164 | t.boolean "started" |
|
165 | t.datetime "start_time" |
|
165 | t.datetime "start_time" |
|
166 |
- t.datetime "created_at", |
|
166 | + t.datetime "created_at", null: false |
|
167 |
- t.datetime "updated_at", |
|
167 | + t.datetime "updated_at", null: false |
|
168 | t.integer "country_id" |
|
168 | t.integer "country_id" |
|
169 | t.string "password" |
|
169 | t.string "password" |
|
170 | end |
|
170 | end |
|
171 |
|
171 | ||
|
172 |
- create_table "submission_view_logs", |
|
172 | + create_table "submission_view_logs", force: :cascade do |t| |
|
173 | t.integer "user_id" |
|
173 | t.integer "user_id" |
|
174 | t.integer "submission_id" |
|
174 | t.integer "submission_id" |
|
175 |
- t.datetime "created_at", |
|
175 | + t.datetime "created_at", null: false |
|
176 |
- t.datetime "updated_at", |
|
176 | + t.datetime "updated_at", null: false |
|
177 | end |
|
177 | end |
|
178 |
|
178 | ||
|
179 |
- create_table "submissions", |
|
179 | + create_table "submissions", force: :cascade do |t| |
|
180 | t.integer "user_id" |
|
180 | t.integer "user_id" |
|
181 | t.integer "problem_id" |
|
181 | t.integer "problem_id" |
|
182 | t.integer "language_id" |
|
182 | t.integer "language_id" |
|
183 | t.text "source" |
|
183 | t.text "source" |
|
184 | t.binary "binary" |
|
184 | t.binary "binary" |
|
185 | t.datetime "submitted_at" |
|
185 | t.datetime "submitted_at" |
|
186 | t.datetime "compiled_at" |
|
186 | t.datetime "compiled_at" |
|
187 | t.text "compiler_message" |
|
187 | t.text "compiler_message" |
|
188 | t.datetime "graded_at" |
|
188 | t.datetime "graded_at" |
|
189 | t.integer "points" |
|
189 | t.integer "points" |
|
190 | t.text "grader_comment" |
|
190 | t.text "grader_comment" |
|
191 | t.integer "number" |
|
191 | t.integer "number" |
|
192 | t.string "source_filename" |
|
192 | t.string "source_filename" |
|
193 | t.float "max_runtime" |
|
193 | t.float "max_runtime" |
|
194 | t.integer "peak_memory" |
|
194 | t.integer "peak_memory" |
|
195 | t.integer "effective_code_length" |
|
195 | t.integer "effective_code_length" |
|
196 | t.string "ip_address" |
|
196 | t.string "ip_address" |
|
197 | end |
|
197 | end |
|
198 |
|
198 | ||
|
199 |
- add_index "submissions", ["user_id", "problem_id", "number"], |
|
199 | + add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true |
|
200 |
- add_index "submissions", ["user_id", "problem_id"], |
|
200 | + add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id" |
|
201 |
|
201 | ||
|
202 |
- create_table "tasks", |
|
202 | + create_table "tasks", force: :cascade do |t| |
|
203 | t.integer "submission_id" |
|
203 | t.integer "submission_id" |
|
204 | t.datetime "created_at" |
|
204 | t.datetime "created_at" |
|
205 | t.integer "status" |
|
205 | t.integer "status" |
|
206 | t.datetime "updated_at" |
|
206 | t.datetime "updated_at" |
|
207 | end |
|
207 | end |
|
208 |
|
208 | ||
|
209 |
- create_table "test_pairs", |
|
209 | + create_table "test_pairs", force: :cascade do |t| |
|
210 | t.integer "problem_id" |
|
210 | t.integer "problem_id" |
|
211 |
- t.text "input", |
|
211 | + t.text "input", limit: 16777215 |
|
212 |
- t.text "solution", |
|
212 | + t.text "solution", limit: 16777215 |
|
213 |
- t.datetime "created_at", |
|
213 | + t.datetime "created_at", null: false |
|
214 |
- t.datetime "updated_at", |
|
214 | + t.datetime "updated_at", null: false |
|
215 | end |
|
215 | end |
|
216 |
|
216 | ||
|
217 |
- create_table "test_requests", |
|
217 | + create_table "test_requests", force: :cascade do |t| |
|
218 | t.integer "user_id" |
|
218 | t.integer "user_id" |
|
219 | t.integer "problem_id" |
|
219 | t.integer "problem_id" |
|
220 | t.integer "submission_id" |
|
220 | t.integer "submission_id" |
|
221 | t.string "input_file_name" |
|
221 | t.string "input_file_name" |
|
222 | t.string "output_file_name" |
|
222 | t.string "output_file_name" |
|
223 | t.string "running_stat" |
|
223 | t.string "running_stat" |
|
224 | t.integer "status" |
|
224 | t.integer "status" |
|
225 |
- t.datetime "updated_at", |
|
225 | + t.datetime "updated_at", null: false |
|
226 | t.datetime "submitted_at" |
|
226 | t.datetime "submitted_at" |
|
227 | t.datetime "compiled_at" |
|
227 | t.datetime "compiled_at" |
|
228 | t.text "compiler_message" |
|
228 | t.text "compiler_message" |
|
229 | t.datetime "graded_at" |
|
229 | t.datetime "graded_at" |
|
230 | t.string "grader_comment" |
|
230 | t.string "grader_comment" |
|
231 |
- t.datetime "created_at", |
|
231 | + t.datetime "created_at", null: false |
|
232 | t.float "running_time" |
|
232 | t.float "running_time" |
|
233 | t.string "exit_status" |
|
233 | t.string "exit_status" |
|
234 | t.integer "memory_usage" |
|
234 | t.integer "memory_usage" |
|
235 | end |
|
235 | end |
|
236 |
|
236 | ||
|
237 |
- add_index "test_requests", ["user_id", "problem_id"], |
|
237 | + add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id" |
|
238 |
|
238 | ||
|
239 |
- create_table "testcases", |
|
239 | + create_table "testcases", force: :cascade do |t| |
|
240 | t.integer "problem_id" |
|
240 | t.integer "problem_id" |
|
241 | t.integer "num" |
|
241 | t.integer "num" |
|
242 | t.integer "group" |
|
242 | t.integer "group" |
|
243 | t.integer "score" |
|
243 | t.integer "score" |
|
244 | t.text "input" |
|
244 | t.text "input" |
|
245 | t.text "sol" |
|
245 | t.text "sol" |
|
246 |
- t.datetime "created_at", |
|
246 | + t.datetime "created_at", null: false |
|
247 |
- t.datetime "updated_at", |
|
247 | + t.datetime "updated_at", null: false |
|
248 | end |
|
248 | end |
|
249 |
|
249 | ||
|
250 |
- add_index "testcases", ["problem_id"], |
|
250 | + add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id" |
|
251 |
|
251 | ||
|
252 |
- create_table "user_contest_stats", |
|
252 | + create_table "user_contest_stats", force: :cascade do |t| |
|
253 | t.integer "user_id" |
|
253 | t.integer "user_id" |
|
254 | t.datetime "started_at" |
|
254 | t.datetime "started_at" |
|
255 |
- t.datetime "created_at", |
|
255 | + t.datetime "created_at", null: false |
|
256 |
- t.datetime "updated_at", |
|
256 | + t.datetime "updated_at", null: false |
|
257 | t.boolean "forced_logout" |
|
257 | t.boolean "forced_logout" |
|
258 | end |
|
258 | end |
|
259 |
|
259 | ||
|
260 |
- create_table "users", |
|
260 | + create_table "users", force: :cascade do |t| |
|
261 |
- t.string "login", |
|
261 | + t.string "login", limit: 50 |
|
262 | t.string "full_name" |
|
262 | t.string "full_name" |
|
263 | t.string "hashed_password" |
|
263 | t.string "hashed_password" |
|
264 |
- t.string "salt", |
|
264 | + t.string "salt", limit: 5 |
|
265 | t.string "alias" |
|
265 | t.string "alias" |
|
266 | t.string "email" |
|
266 | t.string "email" |
|
267 | t.integer "site_id" |
|
267 | t.integer "site_id" |
|
268 | t.integer "country_id" |
|
268 | t.integer "country_id" |
|
269 |
- t.boolean "activated", |
|
269 | + t.boolean "activated", default: false |
|
270 | t.datetime "created_at" |
|
270 | t.datetime "created_at" |
|
271 | t.datetime "updated_at" |
|
271 | t.datetime "updated_at" |
|
272 |
- t.boolean "enabled", |
|
272 | + t.boolean "enabled", default: true |
|
273 | t.string "remark" |
|
273 | t.string "remark" |
|
274 | t.string "last_ip" |
|
274 | t.string "last_ip" |
|
275 | t.string "section" |
|
275 | t.string "section" |
|
276 | end |
|
276 | end |
|
277 |
|
277 | ||
|
278 |
- add_index "users", ["login"], |
|
278 | + add_index "users", ["login"], name: "index_users_on_login", unique: true |
|
279 |
|
279 | ||
|
280 | end |
|
280 | end |
You need to be logged in to leave comments.
Login now