Description:
problem group enabled
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r796:d1494dbef0e7 - - 3 files changed: 70 inserted, 71 deleted

@@ -1,184 +1,181
1 1 GEM
2 2 remote: https://rubygems.org/
3 3 specs:
4 4 RubyInline (3.12.4)
5 5 ZenTest (~> 4.3)
6 6 ZenTest (4.11.2)
7 7 ace-rails-ap (4.2)
8 8 actioncable (5.2.3)
9 9 actionpack (= 5.2.3)
10 10 nio4r (~> 2.0)
11 11 websocket-driver (>= 0.6.1)
12 12 actionmailer (5.2.3)
13 13 actionpack (= 5.2.3)
14 14 actionview (= 5.2.3)
15 15 activejob (= 5.2.3)
16 16 mail (~> 2.5, >= 2.5.4)
17 17 rails-dom-testing (~> 2.0)
18 18 actionpack (5.2.3)
19 19 actionview (= 5.2.3)
20 20 activesupport (= 5.2.3)
21 21 rack (~> 2.0)
22 22 rack-test (>= 0.6.3)
23 23 rails-dom-testing (~> 2.0)
24 24 rails-html-sanitizer (~> 1.0, >= 1.0.2)
25 25 actionview (5.2.3)
26 26 activesupport (= 5.2.3)
27 27 builder (~> 3.1)
28 28 erubi (~> 1.4)
29 29 rails-dom-testing (~> 2.0)
30 30 rails-html-sanitizer (~> 1.0, >= 1.0.3)
31 31 activejob (5.2.3)
32 32 activesupport (= 5.2.3)
33 33 globalid (>= 0.3.6)
34 34 activemodel (5.2.3)
35 35 activesupport (= 5.2.3)
36 36 activerecord (5.2.3)
37 37 activemodel (= 5.2.3)
38 38 activesupport (= 5.2.3)
39 39 arel (>= 9.0)
40 40 activerecord-session_store (1.1.3)
41 41 actionpack (>= 4.0)
42 42 activerecord (>= 4.0)
43 43 multi_json (~> 1.11, >= 1.11.2)
44 44 rack (>= 1.5.2, < 3)
45 45 railties (>= 4.0)
46 46 activestorage (5.2.3)
47 47 actionpack (= 5.2.3)
48 48 activerecord (= 5.2.3)
49 49 marcel (~> 0.3.1)
50 50 activesupport (5.2.3)
51 51 concurrent-ruby (~> 1.0, >= 1.0.2)
52 52 i18n (>= 0.7, < 2)
53 53 minitest (~> 5.1)
54 54 tzinfo (~> 1.1)
55 55 addressable (2.6.0)
56 56 public_suffix (>= 2.0.2, < 4.0)
57 57 ansi (1.5.0)
58 58 arel (9.0.0)
59 59 autoprefixer-rails (9.5.1.1)
60 60 execjs
61 61 best_in_place (3.0.3)
62 62 actionpack (>= 3.2)
63 63 railties (>= 3.2)
64 64 bindex (0.7.0)
65 65 bootsnap (1.4.4)
66 66 msgpack (~> 1.0)
67 67 bootstrap-datepicker-rails (1.8.0.1)
68 68 railties (>= 3.0)
69 69 bootstrap-sass (3.4.1)
70 70 autoprefixer-rails (>= 5.2.1)
71 71 sassc (>= 2.0.0)
72 72 bootstrap-switch-rails (3.3.4)
73 73 bootstrap-toggle-rails (2.2.1.0)
74 74 bootstrap3-datetimepicker-rails (4.17.47)
75 75 momentjs-rails (>= 2.8.1)
76 76 builder (3.2.3)
77 77 byebug (11.0.1)
78 78 capybara (3.25.0)
79 79 addressable
80 80 mini_mime (>= 0.1.3)
81 81 nokogiri (~> 1.8)
82 82 rack (>= 1.6.0)
83 83 rack-test (>= 0.6.3)
84 84 regexp_parser (~> 1.5)
85 85 xpath (~> 3.2)
86 - capybara-console (0.0.4)
87 - capybara
88 - rails (>= 3.0)
89 86 childprocess (1.0.1)
90 87 rake (< 13.0)
91 88 coffee-rails (4.2.2)
92 89 coffee-script (>= 2.2.0)
93 90 railties (>= 4.0.0)
94 91 coffee-script (2.4.1)
95 92 coffee-script-source
96 93 execjs
97 94 coffee-script-source (1.12.2)
98 95 concurrent-ruby (1.1.5)
99 96 crass (1.0.4)
100 97 dynamic_form (1.1.4)
101 98 erubi (1.8.0)
102 99 erubis (2.7.0)
103 100 execjs (2.7.0)
104 101 ffi (1.11.1)
105 102 fuzzy-string-match (1.0.1)
106 103 RubyInline (>= 3.8.6)
107 104 globalid (0.4.2)
108 105 activesupport (>= 4.2.0)
109 106 haml (5.1.0)
110 107 temple (>= 0.8.0)
111 108 tilt
112 109 haml-rails (1.0.0)
113 110 actionpack (>= 4.0.1)
114 111 activesupport (>= 4.0.1)
115 112 haml (>= 4.0.6, < 6.0)
116 113 html2haml (>= 1.0.1)
117 114 railties (>= 4.0.1)
118 115 html2haml (2.2.0)
119 116 erubis (~> 2.7.0)
120 117 haml (>= 4.0, < 6)
121 118 nokogiri (>= 1.6.0)
122 119 ruby_parser (~> 3.5)
123 120 i18n (1.6.0)
124 121 concurrent-ruby (~> 1.0)
125 122 in_place_editing (1.2.0)
126 123 jbuilder (2.9.1)
127 124 activesupport (>= 4.2.0)
128 125 jquery-countdown-rails (2.0.2)
129 126 jquery-datatables-rails (3.4.0)
130 127 actionpack (>= 3.1)
131 128 jquery-rails
132 129 railties (>= 3.1)
133 130 sass-rails
134 131 jquery-rails (4.3.3)
135 132 rails-dom-testing (>= 1, < 3)
136 133 railties (>= 4.2.0)
137 134 thor (>= 0.14, < 2.0)
138 135 jquery-tablesorter (1.26.1)
139 136 railties (>= 3.2, < 6)
140 137 jquery-timepicker-addon-rails (1.4.1)
141 138 railties (>= 3.1)
142 139 jquery-ui-rails (6.0.1)
143 140 railties (>= 3.2.16)
144 141 listen (3.1.5)
145 142 rb-fsevent (~> 0.9, >= 0.9.4)
146 143 rb-inotify (~> 0.9, >= 0.9.7)
147 144 ruby_dep (~> 1.2)
148 145 loofah (2.2.3)
149 146 crass (~> 1.0.2)
150 147 nokogiri (>= 1.5.9)
151 148 mail (2.7.1)
152 149 mini_mime (>= 0.1.1)
153 150 marcel (0.3.3)
154 151 mimemagic (~> 0.3.2)
155 152 method_source (0.9.2)
156 153 mimemagic (0.3.3)
157 154 mini_mime (1.0.1)
158 155 mini_portile2 (2.4.0)
159 156 minitest (5.11.3)
160 157 minitest-reporters (1.3.6)
161 158 ansi
162 159 builder
163 160 minitest (>= 5.0)
164 161 ruby-progressbar
165 162 momentjs-rails (2.20.1)
166 163 railties (>= 3.1)
167 164 msgpack (1.3.0)
168 165 multi_json (1.13.1)
169 166 mysql2 (0.5.2)
170 167 nio4r (2.3.1)
171 168 nokogiri (1.10.3)
172 169 mini_portile2 (~> 2.4.0)
173 170 public_suffix (3.1.1)
174 171 puma (4.0.0)
175 172 nio4r (~> 2.0)
176 173 rack (2.0.7)
177 174 rack-test (1.1.0)
178 175 rack (>= 1.0, < 3)
179 176 rails (5.2.3)
180 177 actioncable (= 5.2.3)
181 178 actionmailer (= 5.2.3)
182 179 actionpack (= 5.2.3)
183 180 actionview (= 5.2.3)
184 181 activejob (= 5.2.3)
@@ -206,136 +203,135
206 203 method_source
207 204 rake (>= 0.8.7)
208 205 thor (>= 0.19.0, < 2.0)
209 206 rake (12.3.2)
210 207 rb-fsevent (0.10.3)
211 208 rb-inotify (0.10.0)
212 209 ffi (~> 1.0)
213 210 rdiscount (2.2.0.1)
214 211 regexp_parser (1.5.1)
215 212 rouge (3.3.0)
216 213 ruby-progressbar (1.10.0)
217 214 ruby_dep (1.5.0)
218 215 ruby_parser (3.13.1)
219 216 sexp_processor (~> 4.9)
220 217 rubyzip (1.2.3)
221 218 sass (3.7.4)
222 219 sass-listen (~> 4.0.0)
223 220 sass-listen (4.0.0)
224 221 rb-fsevent (~> 0.9, >= 0.9.4)
225 222 rb-inotify (~> 0.9, >= 0.9.7)
226 223 sass-rails (5.0.7)
227 224 railties (>= 4.0.0, < 6)
228 225 sass (~> 3.1)
229 226 sprockets (>= 2.8, < 4.0)
230 227 sprockets-rails (>= 2.0, < 4.0)
231 228 tilt (>= 1.1, < 3)
232 229 sassc (2.0.1)
233 230 ffi (~> 1.9)
234 231 rake
235 232 sassc-rails (2.1.1)
236 233 railties (>= 4.0.0)
237 234 sassc (>= 2.0)
238 235 sprockets (> 3.0)
239 236 sprockets-rails
240 237 tilt
241 238 select2-rails (4.0.3)
242 239 thor (~> 0.14)
243 240 selenium-webdriver (3.142.3)
244 241 childprocess (>= 0.5, < 2.0)
245 242 rubyzip (~> 1.2, >= 1.2.2)
246 243 sexp_processor (4.12.0)
247 244 simple_form (4.1.0)
248 245 actionpack (>= 5.0)
249 246 activemodel (>= 5.0)
250 247 spring (2.1.0)
251 248 spring-watcher-listen (2.0.1)
252 249 listen (>= 2.7, < 4.0)
253 250 spring (>= 1.2, < 3.0)
254 251 sprockets (3.7.2)
255 252 concurrent-ruby (~> 1.0)
256 253 rack (> 1, < 3)
257 254 sprockets-rails (3.2.1)
258 255 actionpack (>= 4.0)
259 256 activesupport (>= 4.0)
260 257 sprockets (>= 3.0.0)
261 258 sqlite3 (1.4.1)
262 259 temple (0.8.1)
263 260 thor (0.20.3)
264 261 thread_safe (0.3.6)
265 262 tilt (2.0.9)
266 263 tzinfo (1.2.5)
267 264 thread_safe (~> 0.1)
268 265 uglifier (4.1.20)
269 266 execjs (>= 0.3.0, < 3)
270 267 web-console (3.7.0)
271 268 actionview (>= 5.0)
272 269 activemodel (>= 5.0)
273 270 bindex (>= 0.4.0)
274 271 railties (>= 5.0)
275 272 webdriver (0.1.0)
276 273 websocket-driver (0.7.1)
277 274 websocket-extensions (>= 0.1.0)
278 275 websocket-extensions (0.1.4)
279 276 will_paginate (3.0.12)
280 277 xpath (3.2.0)
281 278 nokogiri (~> 1.8)
282 279 yaml_db (0.7.0)
283 280 rails (>= 3.0)
284 281 rake (>= 0.8.7)
285 282
286 283 PLATFORMS
287 284 ruby
288 285
289 286 DEPENDENCIES
290 287 ace-rails-ap
291 288 activerecord-session_store
292 289 autoprefixer-rails
293 290 best_in_place (~> 3.0.1)
294 291 bootsnap (>= 1.1.0)
295 292 bootstrap-datepicker-rails
296 293 bootstrap-sass (~> 3.4.1)
297 294 bootstrap-switch-rails
298 295 bootstrap-toggle-rails
299 296 bootstrap3-datetimepicker-rails
300 297 byebug
301 298 capybara (>= 2.15)
302 - capybara-console
303 299 coffee-rails
304 300 dynamic_form
305 301 fuzzy-string-match
306 302 haml
307 303 haml-rails
308 304 in_place_editing
309 305 jbuilder (~> 2.5)
310 306 jquery-countdown-rails
311 307 jquery-datatables-rails
312 308 jquery-rails
313 309 jquery-tablesorter
314 310 jquery-timepicker-addon-rails
315 311 jquery-ui-rails
316 312 listen (>= 3.0.5, < 3.2)
317 313 mail
318 314 minitest-reporters
319 315 momentjs-rails
320 316 mysql2
321 317 puma
322 318 rails (~> 5.2)
323 319 rails-controller-testing
324 320 rails_bootstrap_sortable
325 321 rdiscount
326 322 rouge
327 323 sassc-rails
328 324 select2-rails
329 325 selenium-webdriver
330 326 simple_form
331 327 spring
332 328 spring-watcher-listen (~> 2.0.0)
333 329 sqlite3
334 330 uglifier
335 331 web-console (>= 3.3.0)
336 332 webdriver
337 333 will_paginate (~> 3.0.7)
338 334 yaml_db
339 335
340 336 BUNDLED WITH
341 337 1.17.2
@@ -59,109 +59,110
59 59 #check if logged in
60 60 unless session[:user_id]
61 61 if GraderConfiguration[SINGLE_USER_MODE_CONF_KEY]
62 62 unauthorized_redirect('You need to login but you cannot log in at this time')
63 63 else
64 64 unauthorized_redirect('You need to login')
65 65 end
66 66 return false
67 67 end
68 68
69 69 # check if run in single user mode
70 70 if GraderConfiguration[SINGLE_USER_MODE_CONF_KEY]
71 71 if @current_user==nil || (!@current_user.admin?)
72 72 unauthorized_redirect('You cannot log in at this time')
73 73 return false
74 74 end
75 75 end
76 76
77 77 # check if the user is enabled
78 78 unless @current_user.enabled? || @current_user.admin?
79 79 unauthorized_redirect 'Your account is disabled'
80 80 return false
81 81 end
82 82
83 83 # check if user ip is allowed
84 84 unless @current_user.admin? || GraderConfiguration[WHITELIST_IGNORE_CONF_KEY]
85 85 unless is_request_ip_allowed?
86 86 unauthorized_redirect 'Your IP is not allowed to login at this time.'
87 87 return false
88 88 end
89 89 end
90 90
91 91 if GraderConfiguration.multicontests?
92 92 return true if @current_user.admin?
93 93 begin
94 94 if @current_user.contest_stat(true).forced_logout
95 95 flash[:notice] = 'You have been automatically logged out.'
96 96 redirect_to :controller => 'main', :action => 'index'
97 97 end
98 98 rescue
99 99 end
100 100 end
101 101 return true
102 102 end
103 103
104 104 #redirect to root (and also force logout)
105 105 #if the user use different ip from the previous connection
106 106 # only applicable when MULTIPLE_IP_LOGIN options is false only
107 107 def authenticate_by_ip_address
108 108 #this assume that we have already authenticate normally
109 109 unless GraderConfiguration[MULTIPLE_IP_LOGIN_CONF_KEY]
110 110 user = User.find(session[:user_id])
111 111 if (!user.admin? && user.last_ip && user.last_ip != request.remote_ip)
112 112 flash[:notice] = "You cannot use the system from #{request.remote_ip}. Your last ip is #{user.last_ip}"
113 113 redirect_to :controller => 'main', :action => 'login'
114 114 return false
115 115 end
116 116 unless user.last_ip
117 117 user.last_ip = request.remote_ip
118 118 user.save
119 119 end
120 120 end
121 121 return true
122 122 end
123 123
124 124 def authorization
125 125 return false unless check_valid_login
126 126 user = User.find(session[:user_id])
127 127 unless user.roles.detect { |role|
128 128 role.rights.detect{ |right|
129 129 right.controller == self.class.controller_name and
130 130 (right.action == 'all' || right.action == action_name)
131 131 }
132 132 }
133 133 flash[:notice] = 'You are not authorized to view the page you requested'
134 134 #request.env['HTTP_REFERER'] ? (redirect_to :back) : (redirect_to :controller => 'login')
135 135 redirect_to :controller => 'main', :action => 'login'
136 136 return false
137 137 end
138 138 end
139 139
140 140 def verify_time_limit
141 141 return true if session[:user_id]==nil
142 142 user = User.find(session[:user_id], :include => :site)
143 143 return true if user==nil || user.site == nil
144 144 if user.contest_finished?
145 145 flash[:notice] = 'Error: the contest you are participating is over.'
146 146 redirect_to :back
147 147 return false
148 148 end
149 149 return true
150 150 end
151 151
152 152 def is_request_ip_allowed?
153 153 unless GraderConfiguration[WHITELIST_IGNORE_CONF_KEY]
154 154 user_ip = IPAddr.new(request.remote_ip)
155 + allowed = GraderConfiguration[WHITELIST_IP_CONF_KEY] || ''
155 156
156 - GraderConfiguration[WHITELIST_IP_CONF_KEY].delete(' ').split(',').each do |ips|
157 + allowed.delete(' ').split(',').each do |ips|
157 158 allow_ips = IPAddr.new(ips)
158 159 if allow_ips.include?(user_ip)
159 160 return true
160 161 end
161 162 end
162 163 return false
163 164 end
164 165 return true
165 166 end
166 167
167 168 end
@@ -1,308 +1,310
1 1 # This file is auto-generated from the current state of the database. Instead
2 2 # of editing this file, please use the migrations feature of Active Record to
3 3 # incrementally modify your database, and then regenerate this schema definition.
4 4 #
5 5 # Note that this schema.rb definition is the authoritative source for your
6 6 # database schema. If you need to create the application database on another
7 7 # system, you should be using db:schema:load, not running all the migrations
8 8 # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 9 # you'll amass, the slower it'll run and the greater likelihood for issues).
10 10 #
11 11 # It's strongly recommended that you check this file into your version control system.
12 12
13 13 ActiveRecord::Schema.define(version: 2020_08_13_083020) do
14 14
15 - create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
15 + create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
16 16 t.string "author"
17 - t.text "body"
17 + t.text "body", limit: 16777215
18 18 t.boolean "published"
19 - t.datetime "created_at"
20 - t.datetime "updated_at"
19 + t.datetime "created_at", null: false
20 + t.datetime "updated_at", null: false
21 21 t.boolean "frontpage", default: false
22 22 t.boolean "contest_only", default: false
23 23 t.string "title"
24 24 t.string "notes"
25 25 end
26 26
27 - create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
27 + create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
28 28 t.string "title"
29 29 t.boolean "enabled"
30 - t.datetime "created_at"
31 - t.datetime "updated_at"
30 + t.datetime "created_at", null: false
31 + t.datetime "updated_at", null: false
32 32 t.string "name"
33 33 end
34 34
35 - create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
35 + create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
36 36 t.integer "contest_id"
37 37 t.integer "problem_id"
38 38 end
39 39
40 - create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
40 + create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
41 41 t.integer "contest_id"
42 42 t.integer "user_id"
43 43 end
44 44
45 - create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
45 + create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
46 46 t.string "name"
47 - t.datetime "created_at"
48 - t.datetime "updated_at"
47 + t.datetime "created_at", null: false
48 + t.datetime "updated_at", null: false
49 49 end
50 50
51 - create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
52 - t.text "body"
51 + create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
52 + t.text "body", limit: 16777215
53 53 t.boolean "markdowned"
54 - t.datetime "created_at"
55 - t.datetime "updated_at"
54 + t.datetime "created_at", null: false
55 + t.datetime "updated_at", null: false
56 56 end
57 57
58 - create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
58 + create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
59 59 t.string "key"
60 60 t.string "value_type"
61 61 t.string "value"
62 - t.datetime "created_at"
63 - t.datetime "updated_at"
64 - t.text "description"
62 + t.datetime "created_at", null: false
63 + t.datetime "updated_at", null: false
64 + t.text "description", limit: 16777215
65 65 end
66 66
67 - create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
67 + create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
68 68 t.string "host"
69 69 t.integer "pid"
70 70 t.string "mode"
71 71 t.boolean "active"
72 - t.datetime "created_at"
73 - t.datetime "updated_at"
72 + t.datetime "created_at", null: false
73 + t.datetime "updated_at", null: false
74 74 t.integer "task_id"
75 75 t.string "task_type"
76 76 t.boolean "terminated"
77 - t.index ["host", "pid"], name: "index_grader_processes_on_host_and_pid"
77 + t.index ["host", "pid"], name: "index_grader_processes_on_ip_and_pid"
78 78 end
79 79
80 80 create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
81 81 t.string "name"
82 82 t.string "description"
83 83 t.boolean "enabled", default: true
84 84 end
85 85
86 86 create_table "groups_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
87 87 t.integer "problem_id", null: false
88 88 t.integer "group_id", null: false
89 89 t.index ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id"
90 90 end
91 91
92 - create_table "groups_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
92 + create_table "groups_users", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
93 93 t.integer "group_id", null: false
94 94 t.integer "user_id", null: false
95 95 t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id"
96 96 end
97 97
98 98 create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
99 99 t.integer "user_id"
100 100 t.string "ip_address"
101 - t.datetime "created_at"
102 - t.datetime "updated_at"
101 + t.datetime "created_at", null: false
102 + t.datetime "updated_at", null: false
103 103 t.string "status"
104 104 t.index ["updated_at"], name: "index_heart_beats_on_updated_at"
105 105 end
106 106
107 - create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
107 + create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
108 108 t.string "name", limit: 10
109 109 t.string "pretty_name"
110 110 t.string "ext", limit: 10
111 111 t.string "common_ext"
112 112 end
113 113
114 114 create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
115 115 t.integer "user_id"
116 116 t.string "ip_address"
117 - t.datetime "created_at"
118 - t.datetime "updated_at"
117 + t.datetime "created_at", null: false
118 + t.datetime "updated_at", null: false
119 + t.index ["user_id"], name: "index_logins_on_user_id"
119 120 end
120 121
121 - create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
122 + create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
122 123 t.integer "sender_id"
123 124 t.integer "receiver_id"
124 125 t.integer "replying_message_id"
125 - t.text "body"
126 + t.text "body", limit: 16777215
126 127 t.boolean "replied"
127 - t.datetime "created_at"
128 - t.datetime "updated_at"
128 + t.datetime "created_at", null: false
129 + t.datetime "updated_at", null: false
129 130 end
130 131
131 - create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
132 - t.string "name", limit: 30
132 + create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
133 + t.string "name", limit: 100
133 134 t.string "full_name"
134 135 t.integer "full_score"
135 136 t.date "date_added"
136 137 t.boolean "available"
137 138 t.string "url"
138 139 t.integer "description_id"
139 140 t.boolean "test_allowed"
140 141 t.boolean "output_only"
141 142 t.string "description_filename"
142 143 t.boolean "view_testcase"
143 144 end
144 145
145 146 create_table "problems_tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
146 147 t.integer "problem_id"
147 148 t.integer "tag_id"
148 149 t.index ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true
149 150 t.index ["problem_id"], name: "index_problems_tags_on_problem_id"
150 151 t.index ["tag_id"], name: "index_problems_tags_on_tag_id"
151 152 end
152 153
153 - create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
154 + create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
154 155 t.string "name"
155 156 t.string "controller"
156 157 t.string "action"
157 158 end
158 159
159 - create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
160 + create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
160 161 t.integer "right_id"
161 162 t.integer "role_id"
162 163 t.index ["role_id"], name: "index_rights_roles_on_role_id"
163 164 end
164 165
165 - create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
166 + create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
166 167 t.string "name"
167 168 end
168 169
169 - create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
170 + create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
170 171 t.integer "role_id"
171 172 t.integer "user_id"
172 173 t.index ["user_id"], name: "index_roles_users_on_user_id"
173 174 end
174 175
175 - create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
176 + create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
176 177 t.string "session_id"
177 - t.text "data"
178 + t.text "data", limit: 16777215
178 179 t.datetime "updated_at"
179 180 t.index ["session_id"], name: "index_sessions_on_session_id"
180 181 t.index ["updated_at"], name: "index_sessions_on_updated_at"
181 182 end
182 183
183 - create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
184 + create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
184 185 t.string "name"
185 186 t.boolean "started"
186 187 t.datetime "start_time"
187 - t.datetime "created_at"
188 - t.datetime "updated_at"
188 + t.datetime "created_at", null: false
189 + t.datetime "updated_at", null: false
189 190 t.integer "country_id"
190 191 t.string "password"
191 192 end
192 193
193 194 create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
194 195 t.integer "user_id"
195 196 t.integer "submission_id"
196 - t.datetime "created_at"
197 - t.datetime "updated_at"
197 + t.datetime "created_at", null: false
198 + t.datetime "updated_at", null: false
198 199 end
199 200
200 - create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
201 + create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
201 202 t.integer "user_id"
202 203 t.integer "problem_id"
203 204 t.integer "language_id"
204 205 t.text "source", limit: 16777215
205 206 t.binary "binary"
206 207 t.datetime "submitted_at"
207 208 t.datetime "compiled_at"
208 - t.text "compiler_message"
209 + t.text "compiler_message", limit: 16777215
209 210 t.datetime "graded_at"
210 211 t.integer "points"
211 - t.text "grader_comment"
212 + t.text "grader_comment", limit: 16777215
212 213 t.integer "number"
213 214 t.string "source_filename"
214 215 t.float "max_runtime"
215 216 t.integer "peak_memory"
216 217 t.integer "effective_code_length"
217 218 t.string "ip_address"
219 + t.index ["submitted_at"], name: "index_submissions_on_submitted_at"
218 220 t.index ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true
219 221 t.index ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id"
220 222 end
221 223
222 224 create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
223 225 t.string "name", null: false
224 226 t.text "description"
225 227 t.boolean "public"
226 228 t.datetime "created_at", null: false
227 229 t.datetime "updated_at", null: false
228 230 end
229 231
230 - create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
232 + create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
231 233 t.integer "submission_id"
232 234 t.datetime "created_at"
233 235 t.integer "status"
234 236 t.datetime "updated_at"
235 237 t.index ["submission_id"], name: "index_tasks_on_submission_id"
236 238 end
237 239
238 - create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
240 + create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
239 241 t.integer "problem_id"
240 - t.text "input", limit: 16777215
241 - t.text "solution", limit: 16777215
242 - t.datetime "created_at"
243 - t.datetime "updated_at"
242 + t.text "input", limit: 4294967295
243 + t.text "solution", limit: 4294967295
244 + t.datetime "created_at", null: false
245 + t.datetime "updated_at", null: false
244 246 end
245 247
246 - create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
248 + create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
247 249 t.integer "user_id"
248 250 t.integer "problem_id"
249 251 t.integer "submission_id"
250 252 t.string "input_file_name"
251 253 t.string "output_file_name"
252 254 t.string "running_stat"
253 255 t.integer "status"
254 - t.datetime "updated_at"
256 + t.datetime "updated_at", null: false
255 257 t.datetime "submitted_at"
256 258 t.datetime "compiled_at"
257 - t.text "compiler_message"
259 + t.text "compiler_message", limit: 16777215
258 260 t.datetime "graded_at"
259 261 t.string "grader_comment"
260 - t.datetime "created_at"
262 + t.datetime "created_at", null: false
261 263 t.float "running_time"
262 264 t.string "exit_status"
263 265 t.integer "memory_usage"
264 266 t.index ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id"
265 267 end
266 268
267 269 create_table "testcases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
268 270 t.integer "problem_id"
269 271 t.integer "num"
270 272 t.integer "group"
271 273 t.integer "score"
272 274 t.text "input", limit: 4294967295
273 275 t.text "sol", limit: 4294967295
274 - t.datetime "created_at"
275 - t.datetime "updated_at"
276 + t.datetime "created_at", null: false
277 + t.datetime "updated_at", null: false
276 278 t.index ["problem_id"], name: "index_testcases_on_problem_id"
277 279 end
278 280
279 - create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
281 + create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
280 282 t.integer "user_id"
281 283 t.datetime "started_at"
282 - t.datetime "created_at"
283 - t.datetime "updated_at"
284 + t.datetime "created_at", null: false
285 + t.datetime "updated_at", null: false
284 286 t.boolean "forced_logout"
285 287 end
286 288
287 - create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
289 + create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
288 290 t.string "login", limit: 50
289 291 t.string "full_name"
290 292 t.string "hashed_password"
291 293 t.string "salt", limit: 5
292 294 t.string "alias"
293 295 t.string "email"
294 296 t.integer "site_id"
295 297 t.integer "country_id"
296 298 t.boolean "activated", default: false
297 299 t.datetime "created_at"
298 300 t.datetime "updated_at"
299 301 t.string "section"
300 302 t.boolean "enabled", default: true
301 303 t.string "remark"
302 304 t.string "last_ip"
303 305 t.index ["login"], name: "index_users_on_login", unique: true
304 306 end
305 307
306 308 add_foreign_key "problems_tags", "problems"
307 309 add_foreign_key "problems_tags", "tags"
308 310 end
You need to be logged in to leave comments. Login now