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

r841:19cce9abf4b7 - - 6 files changed: 99 inserted, 76 deleted

@@ -0,0 +1,5
1 + class AddDefaultLanguageToUser < ActiveRecord::Migration[5.2]
2 + def change
3 + add_column :users, :default_language, :integer
4 + end
5 + end
@@ -1,148 +1,159
1 require 'net/smtp'
1 require 'net/smtp'
2
2
3 class UsersController < ApplicationController
3 class UsersController < ApplicationController
4
4
5 include MailHelperMethods
5 include MailHelperMethods
6
6
7 before_action :check_valid_login, :except => [:new,
7 before_action :check_valid_login, :except => [:new,
8 :register,
8 :register,
9 :confirm,
9 :confirm,
10 :forget,
10 :forget,
11 :retrieve_password]
11 :retrieve_password]
12
12
13 before_action :verify_online_registration, :only => [:new,
13 before_action :verify_online_registration, :only => [:new,
14 :register,
14 :register,
15 :forget,
15 :forget,
16 :retrieve_password]
16 :retrieve_password]
17
17
18 before_action :admin_authorization, only: [:stat, :toggle_activate, :toggle_enable]
18 before_action :admin_authorization, only: [:stat, :toggle_activate, :toggle_enable]
19
19
20
20
21 #in_place_edit_for :user, :alias_for_editing
21 #in_place_edit_for :user, :alias_for_editing
22 #in_place_edit_for :user, :email_for_editing
22 #in_place_edit_for :user, :email_for_editing
23
23
24 def index
24 def index
25 if !GraderConfiguration['system.user_setting_enabled']
25 if !GraderConfiguration['system.user_setting_enabled']
26 redirect_to :controller => 'main', :action => 'list'
26 redirect_to :controller => 'main', :action => 'list'
27 else
27 else
28 @user = User.find(session[:user_id])
28 @user = User.find(session[:user_id])
29 end
29 end
30 end
30 end
31
31
32 # edit logged in user profile
32 # edit logged in user profile
33 def profile
33 def profile
34 if !GraderConfiguration['system.user_setting_enabled']
34 if !GraderConfiguration['system.user_setting_enabled']
35 redirect_to :controller => 'main', :action => 'list'
35 redirect_to :controller => 'main', :action => 'list'
36 else
36 else
37 @user = current_user;
37 @user = current_user;
38 end
38 end
39 end
39 end
40
40
41 def chg_passwd
41 def chg_passwd
42 user = User.find(session[:user_id])
42 user = User.find(session[:user_id])
43 user.password = params[:password]
43 user.password = params[:password]
44 user.password_confirmation = params[:password_confirmation]
44 user.password_confirmation = params[:password_confirmation]
45 if user.save
45 if user.save
46 flash[:notice] = 'password changed'
46 flash[:notice] = 'password changed'
47 else
47 else
48 flash[:notice] = 'Error: password changing failed'
48 flash[:notice] = 'Error: password changing failed'
49 end
49 end
50 redirect_to :action => 'profile'
50 redirect_to :action => 'profile'
51 end
51 end
52
52
53 + def chg_default_language
54 + user = User.find(session[:user_id])
55 + user.default_language = params[:default_language]
56 + if user.save
57 + flash[:notice] = 'default language changed'
58 + else
59 + flash[:notice] = 'Error: default language changing failed'
60 + end
61 + redirect_to :action => 'profile'
62 + end
63 +
53 def new
64 def new
54 @user = User.new
65 @user = User.new
55 render :action => 'new', :layout => 'empty'
66 render :action => 'new', :layout => 'empty'
56 end
67 end
57
68
58 def register
69 def register
59 if(params[:cancel])
70 if(params[:cancel])
60 redirect_to :controller => 'main', :action => 'login'
71 redirect_to :controller => 'main', :action => 'login'
61 return
72 return
62 end
73 end
63 @user = User.new(user_params)
74 @user = User.new(user_params)
64 @user.password_confirmation = @user.password = User.random_password
75 @user.password_confirmation = @user.password = User.random_password
65 @user.activated = false
76 @user.activated = false
66 if (@user.valid?) and (@user.save)
77 if (@user.valid?) and (@user.save)
67 if send_confirmation_email(@user)
78 if send_confirmation_email(@user)
68 render :action => 'new_splash', :layout => 'empty'
79 render :action => 'new_splash', :layout => 'empty'
69 else
80 else
70 @admin_email = GraderConfiguration['system.admin_email']
81 @admin_email = GraderConfiguration['system.admin_email']
71 render :action => 'email_error', :layout => 'empty'
82 render :action => 'email_error', :layout => 'empty'
72 end
83 end
73 else
84 else
74 @user.errors.add(:base,"Email cannot be blank") if @user.email==''
85 @user.errors.add(:base,"Email cannot be blank") if @user.email==''
75 render :action => 'new', :layout => 'empty'
86 render :action => 'new', :layout => 'empty'
76 end
87 end
77 end
88 end
78
89
79 def confirm
90 def confirm
80 login = params[:login]
91 login = params[:login]
81 key = params[:activation]
92 key = params[:activation]
82 @user = User.find_by_login(login)
93 @user = User.find_by_login(login)
83 if (@user) and (@user.verify_activation_key(key))
94 if (@user) and (@user.verify_activation_key(key))
84 if @user.valid? # check uniquenss of email
95 if @user.valid? # check uniquenss of email
85 @user.activated = true
96 @user.activated = true
86 @user.save
97 @user.save
87 @result = :successful
98 @result = :successful
88 else
99 else
89 @result = :email_used
100 @result = :email_used
90 end
101 end
91 else
102 else
92 @result = :failed
103 @result = :failed
93 end
104 end
94 render :action => 'confirm', :layout => 'empty'
105 render :action => 'confirm', :layout => 'empty'
95 end
106 end
96
107
97 def forget
108 def forget
98 render :action => 'forget', :layout => 'empty'
109 render :action => 'forget', :layout => 'empty'
99 end
110 end
100
111
101 def retrieve_password
112 def retrieve_password
102 email = params[:email]
113 email = params[:email]
103 user = User.find_by_email(email)
114 user = User.find_by_email(email)
104 if user
115 if user
105 last_updated_time = user.updated_at || user.created_at || (Time.now.gmtime - 1.hour)
116 last_updated_time = user.updated_at || user.created_at || (Time.now.gmtime - 1.hour)
106 if last_updated_time > Time.now.gmtime - 5.minutes
117 if last_updated_time > Time.now.gmtime - 5.minutes
107 flash[:notice] = 'The account has recently created or new password has recently been requested. Please wait for 5 minutes'
118 flash[:notice] = 'The account has recently created or new password has recently been requested. Please wait for 5 minutes'
108 else
119 else
109 user.password = user.password_confirmation = User.random_password
120 user.password = user.password_confirmation = User.random_password
110 user.save
121 user.save
111 send_new_password_email(user)
122 send_new_password_email(user)
112 flash[:notice] = 'New password has been mailed to you.'
123 flash[:notice] = 'New password has been mailed to you.'
113 end
124 end
114 else
125 else
115 flash[:notice] = I18n.t 'registration.password_retrieval.no_email'
126 flash[:notice] = I18n.t 'registration.password_retrieval.no_email'
116 end
127 end
117 redirect_to :action => 'forget'
128 redirect_to :action => 'forget'
118 end
129 end
119
130
120 def stat
131 def stat
121 @user = User.find(params[:id])
132 @user = User.find(params[:id])
122 @submission = Submission.joins(:problem).where(user_id: params[:id])
133 @submission = Submission.joins(:problem).where(user_id: params[:id])
123 @submission = @submission.where('problems.available = true') unless current_user.admin?
134 @submission = @submission.where('problems.available = true') unless current_user.admin?
124
135
125 range = 120
136 range = 120
126 @histogram = { data: Array.new(range,0), summary: {} }
137 @histogram = { data: Array.new(range,0), summary: {} }
127 @summary = {count: 0, solve: 0, attempt: 0}
138 @summary = {count: 0, solve: 0, attempt: 0}
128 problem = Hash.new(0)
139 problem = Hash.new(0)
129
140
130 @submission.find_each do |sub|
141 @submission.find_each do |sub|
131 #histogram
142 #histogram
132 d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60
143 d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60
133 @histogram[:data][d.to_i] += 1 if d < range
144 @histogram[:data][d.to_i] += 1 if d < range
134
145
135 @summary[:count] += 1
146 @summary[:count] += 1
136 next unless sub.problem
147 next unless sub.problem
137 problem[sub.problem] = [problem[sub.problem], ( (sub.try(:points) || 0) >= sub.problem.full_score) ? 1 : 0].max
148 problem[sub.problem] = [problem[sub.problem], ( (sub.try(:points) || 0) >= sub.problem.full_score) ? 1 : 0].max
138 end
149 end
139
150
140 @histogram[:summary][:max] = [@histogram[:data].max,1].max
151 @histogram[:summary][:max] = [@histogram[:data].max,1].max
141 @summary[:attempt] = problem.count
152 @summary[:attempt] = problem.count
142 problem.each_value { |v| @summary[:solve] += 1 if v == 1 }
153 problem.each_value { |v| @summary[:solve] += 1 if v == 1 }
143 end
154 end
144
155
145 def toggle_activate
156 def toggle_activate
146 @user = User.find(params[:id])
157 @user = User.find(params[:id])
147 @user.update_attributes( activated: !@user.activated? )
158 @user.update_attributes( activated: !@user.activated? )
148 respond_to do |format|
159 respond_to do |format|
@@ -1,87 +1,87
1 %textarea#text_sourcecode{style: "display:none"}~ @source
1 %textarea#text_sourcecode{style: "display:none"}~ @source
2 .container
2 .container
3 .row
3 .row
4 .col-md-12
4 .col-md-12
5 %h2 Live submit
5 %h2 Live submit
6
6
7 .row
7 .row
8 .col-md-12
8 .col-md-12
9 .alert.alert-info
9 .alert.alert-info
10 Write your code in the following box, choose language, and click submit button when finished
10 Write your code in the following box, choose language, and click submit button when finished
11 .row
11 .row
12 .col-md-8
12 .col-md-8
13 %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'}
13 %div#editor{style: 'height: 500px; border-radius: 7px; font-size: 14px;'}
14 .col-md-4
14 .col-md-4
15 - # submission form
15 - # submission form
16 = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do
16 = form_tag({controller: :main, :action => 'submit'}, :multipart => true, class: 'form') do
17
17
18 = hidden_field_tag 'editor_text', @source
18 = hidden_field_tag 'editor_text', @source
19 = hidden_field_tag 'submission[problem_id]', @problem.id
19 = hidden_field_tag 'submission[problem_id]', @problem.id
20 .form-group
20 .form-group
21 = label_tag "Task:"
21 = label_tag "Task:"
22 = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true
22 = text_field_tag 'asdf', "#{@problem.long_name}", class: 'form-control', disabled: true
23 .form-group
23 .form-group
24 = label_tag "Description:"
24 = label_tag "Description:"
25 = link_to_description_if_any "[download] <span class='glyphicon glyphicon-file'></span>".html_safe, @problem
25 = link_to_description_if_any "[download] <span class='glyphicon glyphicon-file'></span>".html_safe, @problem
26
26
27 .form-group
27 .form-group
28 = label_tag 'Language:'
28 = label_tag 'Language:'
29 - = 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"
29 + = select_tag 'language_id', options_from_collection_for_select(Language.all, 'id', 'pretty_name', @lang_id || @current_user.default_language || Language.find_by_pretty_name("Python").id || Language.first.id), class: 'form-control select', style: "width: 100px"
30 .form-group
30 .form-group
31 .input-group
31 .input-group
32 %span.input-group-btn
32 %span.input-group-btn
33 %span.btn.btn-default.btn-file
33 %span.btn.btn-default.btn-file
34 Browse
34 Browse
35 = file_field_tag 'load_file'
35 = file_field_tag 'load_file'
36 = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
36 = text_field_tag '' , nil, {readonly: true, class: 'form-control'}
37 .form-group
37 .form-group
38 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
38 = submit_tag 'Submit', class: 'btn btn-success', id: 'live_submit',
39 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
39 data: {confirm: "Submitting this source code for task #{@problem.long_name}?"}
40 - # latest submission status
40 - # latest submission status
41 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
41 .panel{class: (@submission && @submission.graded_at) ? "panel-info" : "panel-warning"}
42 .panel-heading
42 .panel-heading
43 Latest Submission Status
43 Latest Submission Status
44 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
44 = link_to "Refresh",get_latest_submission_status_submissions_path(@submission.user,@problem), class: "btn btn-default btn-sm", remote: true if @submission
45 .panel-body
45 .panel-body
46 %div#latest_status
46 %div#latest_status
47 - if @submission
47 - if @submission
48 = render :partial => 'submission_short',
48 = render :partial => 'submission_short',
49 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
49 :locals => {submission: @submission, problem_name: @problem.name, problem_id: @problem.id }
50
50
51 - if @submission
51 - if @submission
52 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
52 .modal.fade#compiler{tabindex: -1,role: 'dialog'}
53 .modal-dialog.modal-lg{role:'document'}
53 .modal-dialog.modal-lg{role:'document'}
54 .modal-content
54 .modal-content
55 .modal-header
55 .modal-header
56 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
56 %button.close{type: 'button', data: {dismissed: :modal}, aria: {label: 'close'}}
57 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
57 %span{aria: {hidden: 'true'}, data: {dismiss: 'modal'}} &times;
58 %h4 Compiler message
58 %h4 Compiler message
59 .modal-body
59 .modal-body
60 %pre#compiler_msg= @submission.compiler_message
60 %pre#compiler_msg= @submission.compiler_message
61 .modal-footer
61 .modal-footer
62 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
62 %button.btn.btn-default{type: 'button', data: {dismiss: 'modal'}} Close
63
63
64 :javascript
64 :javascript
65 $(document).ready(function() {
65 $(document).ready(function() {
66 e = ace.edit("editor")
66 e = ace.edit("editor")
67 e.setValue($("#text_sourcecode").val());
67 e.setValue($("#text_sourcecode").val());
68 e.gotoLine(1);
68 e.gotoLine(1);
69 $("#language_id").trigger('change');
69 $("#language_id").trigger('change');
70
70
71 $("#load_file").on('change',function(evt) {
71 $("#load_file").on('change',function(evt) {
72 var file = evt.target.files[0];
72 var file = evt.target.files[0];
73 var reader = new FileReader();
73 var reader = new FileReader();
74 reader.onload = function(theFile) {
74 reader.onload = function(theFile) {
75 var e = ace.edit("editor")
75 var e = ace.edit("editor")
76 e.setValue(theFile.target.result);
76 e.setValue(theFile.target.result);
77 e.gotoLine(1);
77 e.gotoLine(1);
78 };
78 };
79 reader.readAsText(file)
79 reader.readAsText(file)
80 });
80 });
81
81
82 //brython();
82 //brython();
83 });
83 });
84
84
85
85
86
86
87
87
@@ -1,24 +1,29
1
1
2 .container-fluid
2 .container-fluid
3 - = form_tag :action => 'chg_passwd', :method => 'post' do
3 + .row
4 - .row
4 + .col-md-6
5 - .col-md-6
5 + %h1 Your account settings
6 - %h1 Your account settings
6 + .form-group
7 + %label{:for => "login"} Login
8 + =@user.login
9 + .form-group
10 + %label{:for => "full_name"} Full name
11 + =@user.full_name
12 + = form_tag :action => 'chg_default_language', :method => 'post' do
13 + %h2 Change default submission language
7 .form-group
14 .form-group
8 - %label{:for => "login"} Login
15 + = select_tag 'default_language', options_from_collection_for_select(Language.all, 'id', 'pretty_name', @user.default_language || Language.find_by_pretty_name("Python").id || Language.first.id), class: 'form-control select', style: "width: 100px"
9 - =@user.login
16 + = submit_tag 'Save', class: 'btn btn-success'
10 - .form-group
17 + %br
11 - %label{:for => "full_name"} Full name
18 + = form_tag :action => 'chg_passwd', :method => 'post' do
12 - =@user.full_name
19 + %h2 Change password
13 .form-group
20 .form-group
14 %label{:for => "password"} Password
21 %label{:for => "password"} Password
15 =password_field_tag :password, nil, class: 'form-control'
22 =password_field_tag :password, nil, class: 'form-control'
16 .form-group
23 .form-group
17 %label{:for => "password_confirmation"} Password confirmation
24 %label{:for => "password_confirmation"} Password confirmation
18 =password_field_tag :password_confirmation, nil, class: 'form-control'
25 =password_field_tag :password_confirmation, nil, class: 'form-control'
19 - .row
20 - .col-md-6
21 =submit_tag 'Edit', class: 'btn btn-primary'
26 =submit_tag 'Edit', class: 'btn btn-primary'
22
27
23
28
24
29
@@ -1,183 +1,184
1 Rails.application.routes.draw do
1 Rails.application.routes.draw do
2 resources :tags
2 resources :tags
3 get "sources/direct_edit"
3 get "sources/direct_edit"
4
4
5 root :to => 'main#login'
5 root :to => 'main#login'
6
6
7 #logins
7 #logins
8 match 'login/login', to: 'login#login', via: [:get,:post]
8 match 'login/login', to: 'login#login', via: [:get,:post]
9
9
10 resources :contests
10 resources :contests
11 resources :sites
11 resources :sites
12 resources :test
12 resources :test
13
13
14 resources :messages do
14 resources :messages do
15 member do
15 member do
16 get 'hide'
16 get 'hide'
17 post 'reply'
17 post 'reply'
18 end
18 end
19 collection do
19 collection do
20 get 'console'
20 get 'console'
21 get 'list_all'
21 get 'list_all'
22 end
22 end
23 end
23 end
24
24
25 resources :announcements do
25 resources :announcements do
26 member do
26 member do
27 get 'toggle','toggle_front'
27 get 'toggle','toggle_front'
28 end
28 end
29 end
29 end
30
30
31 resources :problems do
31 resources :problems do
32 member do
32 member do
33 get 'toggle'
33 get 'toggle'
34 get 'toggle_test'
34 get 'toggle_test'
35 get 'toggle_view_testcase'
35 get 'toggle_view_testcase'
36 get 'stat'
36 get 'stat'
37 end
37 end
38 collection do
38 collection do
39 get 'turn_all_off'
39 get 'turn_all_off'
40 get 'turn_all_on'
40 get 'turn_all_on'
41 get 'import'
41 get 'import'
42 get 'manage'
42 get 'manage'
43 get 'quick_create'
43 get 'quick_create'
44 post 'do_manage'
44 post 'do_manage'
45 post 'do_import'
45 post 'do_import'
46 end
46 end
47 end
47 end
48
48
49 resources :groups do
49 resources :groups do
50 member do
50 member do
51 post 'add_user', to: 'groups#add_user', as: 'add_user'
51 post 'add_user', to: 'groups#add_user', as: 'add_user'
52 delete 'remove_user/:user_id', to: 'groups#remove_user', as: 'remove_user'
52 delete 'remove_user/:user_id', to: 'groups#remove_user', as: 'remove_user'
53 delete 'remove_all_user', to: 'groups#remove_all_user', as: 'remove_all_user'
53 delete 'remove_all_user', to: 'groups#remove_all_user', as: 'remove_all_user'
54 post 'add_problem', to: 'groups#add_problem', as: 'add_problem'
54 post 'add_problem', to: 'groups#add_problem', as: 'add_problem'
55 delete 'remove_problem/:problem_id', to: 'groups#remove_problem', as: 'remove_problem'
55 delete 'remove_problem/:problem_id', to: 'groups#remove_problem', as: 'remove_problem'
56 delete 'remove_all_problem', to: 'groups#remove_all_problem', as: 'remove_all_problem'
56 delete 'remove_all_problem', to: 'groups#remove_all_problem', as: 'remove_all_problem'
57 get 'toggle'
57 get 'toggle'
58 end
58 end
59 collection do
59 collection do
60
60
61 end
61 end
62 end
62 end
63
63
64 resources :testcases, only: [] do
64 resources :testcases, only: [] do
65 member do
65 member do
66 get 'download_input'
66 get 'download_input'
67 get 'download_sol'
67 get 'download_sol'
68 end
68 end
69 collection do
69 collection do
70 get 'show_problem/:problem_id(/:test_num)' => 'testcases#show_problem', as: 'show_problem'
70 get 'show_problem/:problem_id(/:test_num)' => 'testcases#show_problem', as: 'show_problem'
71 end
71 end
72 end
72 end
73
73
74 resources :grader_configuration, controller: 'configurations' do
74 resources :grader_configuration, controller: 'configurations' do
75 collection do
75 collection do
76 get 'set_exam_right(/:value)', action: 'set_exam_right', as: 'set_exam_right'
76 get 'set_exam_right(/:value)', action: 'set_exam_right', as: 'set_exam_right'
77 end
77 end
78 end
78 end
79
79
80 resources :users do
80 resources :users do
81 member do
81 member do
82 get 'toggle_activate', 'toggle_enable'
82 get 'toggle_activate', 'toggle_enable'
83 get 'stat'
83 get 'stat'
84 end
84 end
85 collection do
85 collection do
86 get 'profile'
86 get 'profile'
87 post 'chg_passwd'
87 post 'chg_passwd'
88 + post 'chg_default_language'
88 end
89 end
89 end
90 end
90
91
91 resources :submissions do
92 resources :submissions do
92 member do
93 member do
93 get 'download'
94 get 'download'
94 get 'compiler_msg'
95 get 'compiler_msg'
95 get 'rejudge'
96 get 'rejudge'
96 end
97 end
97 collection do
98 collection do
98 get 'prob/:problem_id', to: 'submissions#index', as: 'problem'
99 get 'prob/:problem_id', to: 'submissions#index', as: 'problem'
99 get 'direct_edit_problem/:problem_id(/:user_id)', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem'
100 get 'direct_edit_problem/:problem_id(/:user_id)', to: 'submissions#direct_edit_problem', as: 'direct_edit_problem'
100 get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status'
101 get 'get_latest_submission_status/:uid/:pid', to: 'submissions#get_latest_submission_status', as: 'get_latest_submission_status'
101 end
102 end
102 end
103 end
103
104
104
105
105 #user admin
106 #user admin
106 resources :user_admin do
107 resources :user_admin do
107 collection do
108 collection do
108 match 'bulk_manage', via: [:get, :post]
109 match 'bulk_manage', via: [:get, :post]
109 get 'bulk_mail'
110 get 'bulk_mail'
110 get 'user_stat'
111 get 'user_stat'
111 get 'import'
112 get 'import'
112 get 'new_list'
113 get 'new_list'
113 get 'admin'
114 get 'admin'
114 get 'active'
115 get 'active'
115 get 'mass_mailing'
116 get 'mass_mailing'
116 match 'modify_role', via: [:get, :post]
117 match 'modify_role', via: [:get, :post]
117 match 'create_from_list', via: [:get, :post]
118 match 'create_from_list', via: [:get, :post]
118 match 'random_all_passwords', via: [:get, :post]
119 match 'random_all_passwords', via: [:get, :post]
119 end
120 end
120 member do
121 member do
121 get 'clear_last_ip'
122 get 'clear_last_ip'
122 end
123 end
123 end
124 end
124
125
125 resources :contest_management, only: [:index] do
126 resources :contest_management, only: [:index] do
126 collection do
127 collection do
127 get 'user_stat'
128 get 'user_stat'
128 get 'clear_stat'
129 get 'clear_stat'
129 get 'clear_all_stat'
130 get 'clear_all_stat'
130 get 'change_contest_mode'
131 get 'change_contest_mode'
131 end
132 end
132 end
133 end
133
134
134 #get 'user_admin', to: 'user_admin#index'
135 #get 'user_admin', to: 'user_admin#index'
135 #get 'user_admin/bulk_manage', to: 'user_admin#bulk_manage', as: 'bulk_manage_user_admin'
136 #get 'user_admin/bulk_manage', to: 'user_admin#bulk_manage', as: 'bulk_manage_user_admin'
136 #post 'user_admin', to: 'user_admin#create'
137 #post 'user_admin', to: 'user_admin#create'
137 #delete 'user_admin/:id', to: 'user_admin#destroy', as: 'user_admin_destroy'
138 #delete 'user_admin/:id', to: 'user_admin#destroy', as: 'user_admin_destroy'
138
139
139 #singular resource
140 #singular resource
140 #---- BEWARE ---- singular resource maps to plural controller by default, we can override by provide controller name directly
141 #---- BEWARE ---- singular resource maps to plural controller by default, we can override by provide controller name directly
141 #report
142 #report
142 resource :report, only: [], controller: 'report' do
143 resource :report, only: [], controller: 'report' do
143 get 'login'
144 get 'login'
144 get 'multiple_login'
145 get 'multiple_login'
145 get 'problem_hof(/:id)', action: 'problem_hof', as: 'problem_hof'
146 get 'problem_hof(/:id)', action: 'problem_hof', as: 'problem_hof'
146 get 'current_score(/:group_id)', action: 'current_score', as: 'current_score'
147 get 'current_score(/:group_id)', action: 'current_score', as: 'current_score'
147 get 'max_score'
148 get 'max_score'
148 post 'show_max_score'
149 post 'show_max_score'
149 get 'stuck'
150 get 'stuck'
150 get 'cheat_report'
151 get 'cheat_report'
151 post 'cheat_report'
152 post 'cheat_report'
152 get 'cheat_scrutinize'
153 get 'cheat_scrutinize'
153 post 'cheat_scrutinize'
154 post 'cheat_scrutinize'
154 get 'submission'
155 get 'submission'
155 post 'submission_query'
156 post 'submission_query'
156 get 'login_stat'
157 get 'login_stat'
157 post 'login_stat'
158 post 'login_stat'
158 get 'login'
159 get 'login'
159 post 'login_summary_query'
160 post 'login_summary_query'
160 post 'login_detail_query'
161 post 'login_detail_query'
161 end
162 end
162 #get 'report/current_score', to: 'report#current_score', as: 'report_current_score'
163 #get 'report/current_score', to: 'report#current_score', as: 'report_current_score'
163 #get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof'
164 #get 'report/problem_hof(/:id)', to: 'report#problem_hof', as: 'report_problem_hof'
164 #get "report/login"
165 #get "report/login"
165 #get 'report/max_score', to: 'report#max_score', as: 'report_max_score'
166 #get 'report/max_score', to: 'report#max_score', as: 'report_max_score'
166 #post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score'
167 #post 'report/show_max_score', to: 'report#show_max_score', as: 'report_show_max_score'
167
168
168 resource :main, only: [], controller: 'main' do
169 resource :main, only: [], controller: 'main' do
169 get 'login'
170 get 'login'
170 get 'logout'
171 get 'logout'
171 get 'list'
172 get 'list'
172 get 'submission(/:id)', action: 'submission', as: 'main_submission'
173 get 'submission(/:id)', action: 'submission', as: 'main_submission'
173 get 'announcements'
174 get 'announcements'
174 get 'help'
175 get 'help'
175 post 'submit'
176 post 'submit'
176 end
177 end
177 #main
178 #main
178 #get "main/list"
179 #get "main/list"
179 #get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission'
180 #get 'main/submission(/:id)', to: 'main#submission', as: 'main_submission'
180 #post 'main/submit', to: 'main#submit'
181 #post 'main/submit', to: 'main#submit'
181 #get 'main/announcements', to: 'main#announcements'
182 #get 'main/announcements', to: 'main#announcements'
182
183
183
184
@@ -1,311 +1,312
1 # This file is auto-generated from the current state of the database. Instead
1 # This file is auto-generated from the current state of the database. Instead
2 # of editing this file, please use the migrations feature of Active Record to
2 # of editing this file, please use the migrations feature of Active Record to
3 # incrementally modify your database, and then regenerate this schema definition.
3 # incrementally modify your database, and then regenerate this schema definition.
4 #
4 #
5 # Note that this schema.rb definition is the authoritative source for your
5 # Note that this schema.rb definition is the authoritative source for your
6 # database schema. If you need to create the application database on another
6 # database schema. If you need to create the application database on another
7 # system, you should be using db:schema:load, not running all the migrations
7 # system, you should be using db:schema:load, not running all the migrations
8 # from scratch. The latter is a flawed and unsustainable approach (the more migrations
8 # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 # you'll amass, the slower it'll run and the greater likelihood for issues).
9 # you'll amass, the slower it'll run and the greater likelihood for issues).
10 #
10 #
11 # It's strongly recommended that you check this file into your version control system.
11 # It's strongly recommended that you check this file into your version control system.
12
12
13 - ActiveRecord::Schema.define(version: 2021_01_24_101028) do
13 + ActiveRecord::Schema.define(version: 2021_01_30_121812) do
14
14
15 - create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
15 + create_table "announcements", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
16 t.string "author"
16 t.string "author"
17 t.text "body"
17 t.text "body"
18 t.boolean "published"
18 t.boolean "published"
19 - t.datetime "created_at", null: false
19 + t.datetime "created_at"
20 - t.datetime "updated_at", null: false
20 + t.datetime "updated_at"
21 t.boolean "frontpage", default: false
21 t.boolean "frontpage", default: false
22 t.boolean "contest_only", default: false
22 t.boolean "contest_only", default: false
23 t.string "title"
23 t.string "title"
24 t.string "notes"
24 t.string "notes"
25 t.boolean "on_nav_bar", default: false
25 t.boolean "on_nav_bar", default: false
26 end
26 end
27
27
28 - create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
28 + create_table "contests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", 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", null: false
31 + t.datetime "created_at"
32 - t.datetime "updated_at", null: false
32 + t.datetime "updated_at"
33 t.string "name"
33 t.string "name"
34 end
34 end
35
35
36 - create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
36 + create_table "contests_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", 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", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
41 + create_table "contests_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", 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", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
46 + create_table "countries", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
47 t.string "name"
47 t.string "name"
48 - t.datetime "created_at", null: false
48 + t.datetime "created_at"
49 - t.datetime "updated_at", null: false
49 + t.datetime "updated_at"
50 end
50 end
51
51
52 - create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
52 + create_table "descriptions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", 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", null: false
55 + t.datetime "created_at"
56 - t.datetime "updated_at", null: false
56 + t.datetime "updated_at"
57 end
57 end
58
58
59 - create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
59 + create_table "grader_configurations", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", 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", null: false
63 + t.datetime "created_at"
64 - t.datetime "updated_at", null: false
64 + t.datetime "updated_at"
65 t.text "description"
65 t.text "description"
66 end
66 end
67
67
68 - create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
68 + create_table "grader_processes", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", 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", null: false
73 + t.datetime "created_at"
74 - t.datetime "updated_at", null: false
74 + t.datetime "updated_at"
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 - t.index ["host", "pid"], name: "index_grader_processes_on_ip_and_pid"
78 + t.index ["host", "pid"], name: "index_grader_processes_on_host_and_pid"
79 end
79 end
80
80
81 - create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
81 + create_table "groups", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
82 t.string "name"
82 t.string "name"
83 t.string "description"
83 t.string "description"
84 t.boolean "enabled", default: true
84 t.boolean "enabled", default: true
85 end
85 end
86
86
87 - create_table "groups_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
87 + create_table "groups_problems", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
88 t.integer "problem_id", null: false
88 t.integer "problem_id", null: false
89 t.integer "group_id", null: false
89 t.integer "group_id", null: false
90 t.index ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id"
90 t.index ["group_id", "problem_id"], name: "index_groups_problems_on_group_id_and_problem_id"
91 end
91 end
92
92
93 - create_table "groups_users", options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
93 + create_table "groups_users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
94 t.integer "group_id", null: false
94 t.integer "group_id", null: false
95 t.integer "user_id", null: false
95 t.integer "user_id", null: false
96 t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id"
96 t.index ["user_id", "group_id"], name: "index_groups_users_on_user_id_and_group_id"
97 end
97 end
98
98
99 - create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
99 + create_table "heart_beats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", 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", null: false
102 + t.datetime "created_at"
103 - t.datetime "updated_at", null: false
103 + t.datetime "updated_at"
104 t.string "status"
104 t.string "status"
105 t.index ["updated_at"], name: "index_heart_beats_on_updated_at"
105 t.index ["updated_at"], name: "index_heart_beats_on_updated_at"
106 end
106 end
107
107
108 - create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
108 + create_table "languages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
109 t.string "name", limit: 10
109 t.string "name", limit: 10
110 t.string "pretty_name"
110 t.string "pretty_name"
111 t.string "ext", limit: 10
111 t.string "ext", limit: 10
112 t.string "common_ext"
112 t.string "common_ext"
113 end
113 end
114
114
115 - create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
115 + create_table "logins", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
116 t.integer "user_id"
116 t.integer "user_id"
117 t.string "ip_address"
117 t.string "ip_address"
118 - t.datetime "created_at", null: false
118 + t.datetime "created_at"
119 - t.datetime "updated_at", null: false
119 + t.datetime "updated_at"
120 t.index ["user_id"], name: "index_logins_on_user_id"
120 t.index ["user_id"], name: "index_logins_on_user_id"
121 end
121 end
122
122
123 - create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
123 + create_table "messages", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
124 t.integer "sender_id"
124 t.integer "sender_id"
125 t.integer "receiver_id"
125 t.integer "receiver_id"
126 t.integer "replying_message_id"
126 t.integer "replying_message_id"
127 t.text "body"
127 t.text "body"
128 t.boolean "replied"
128 t.boolean "replied"
129 - t.datetime "created_at", null: false
129 + t.datetime "created_at"
130 - t.datetime "updated_at", null: false
130 + t.datetime "updated_at"
131 end
131 end
132
132
133 - create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
133 + create_table "problems", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
134 t.string "name", limit: 30
134 t.string "name", limit: 30
135 t.string "full_name"
135 t.string "full_name"
136 t.integer "full_score"
136 t.integer "full_score"
137 t.date "date_added"
137 t.date "date_added"
138 t.boolean "available"
138 t.boolean "available"
139 t.string "url"
139 t.string "url"
140 t.integer "description_id"
140 t.integer "description_id"
141 t.boolean "test_allowed"
141 t.boolean "test_allowed"
142 t.boolean "output_only"
142 t.boolean "output_only"
143 t.string "description_filename"
143 t.string "description_filename"
144 t.boolean "view_testcase"
144 t.boolean "view_testcase"
145 end
145 end
146
146
147 - create_table "problems_tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
147 + create_table "problems_tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
148 t.integer "problem_id"
148 t.integer "problem_id"
149 t.integer "tag_id"
149 t.integer "tag_id"
150 t.index ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true
150 t.index ["problem_id", "tag_id"], name: "index_problems_tags_on_problem_id_and_tag_id", unique: true
151 t.index ["problem_id"], name: "index_problems_tags_on_problem_id"
151 t.index ["problem_id"], name: "index_problems_tags_on_problem_id"
152 t.index ["tag_id"], name: "index_problems_tags_on_tag_id"
152 t.index ["tag_id"], name: "index_problems_tags_on_tag_id"
153 end
153 end
154
154
155 - create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
155 + create_table "rights", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
156 t.string "name"
156 t.string "name"
157 t.string "controller"
157 t.string "controller"
158 t.string "action"
158 t.string "action"
159 end
159 end
160
160
161 - create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
161 + create_table "rights_roles", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
162 t.integer "right_id"
162 t.integer "right_id"
163 t.integer "role_id"
163 t.integer "role_id"
164 t.index ["role_id"], name: "index_rights_roles_on_role_id"
164 t.index ["role_id"], name: "index_rights_roles_on_role_id"
165 end
165 end
166
166
167 - create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
167 + create_table "roles", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
168 t.string "name"
168 t.string "name"
169 end
169 end
170
170
171 - create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
171 + create_table "roles_users", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
172 t.integer "role_id"
172 t.integer "role_id"
173 t.integer "user_id"
173 t.integer "user_id"
174 t.index ["user_id"], name: "index_roles_users_on_user_id"
174 t.index ["user_id"], name: "index_roles_users_on_user_id"
175 end
175 end
176
176
177 - create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
177 + create_table "sessions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
178 t.string "session_id"
178 t.string "session_id"
179 t.text "data"
179 t.text "data"
180 t.datetime "updated_at"
180 t.datetime "updated_at"
181 t.index ["session_id"], name: "index_sessions_on_session_id"
181 t.index ["session_id"], name: "index_sessions_on_session_id"
182 t.index ["updated_at"], name: "index_sessions_on_updated_at"
182 t.index ["updated_at"], name: "index_sessions_on_updated_at"
183 end
183 end
184
184
185 - create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
185 + create_table "sites", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
186 t.string "name"
186 t.string "name"
187 t.boolean "started"
187 t.boolean "started"
188 t.datetime "start_time"
188 t.datetime "start_time"
189 - t.datetime "created_at", null: false
189 + t.datetime "created_at"
190 - t.datetime "updated_at", null: false
190 + t.datetime "updated_at"
191 t.integer "country_id"
191 t.integer "country_id"
192 t.string "password"
192 t.string "password"
193 end
193 end
194
194
195 - create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
195 + create_table "submission_view_logs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
196 t.integer "user_id"
196 t.integer "user_id"
197 t.integer "submission_id"
197 t.integer "submission_id"
198 - t.datetime "created_at", null: false
198 + t.datetime "created_at"
199 - t.datetime "updated_at", null: false
199 + t.datetime "updated_at"
200 end
200 end
201
201
202 - create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
202 + create_table "submissions", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
203 t.integer "user_id"
203 t.integer "user_id"
204 t.integer "problem_id"
204 t.integer "problem_id"
205 t.integer "language_id"
205 t.integer "language_id"
206 t.text "source", limit: 16777215
206 t.text "source", limit: 16777215
207 t.binary "binary"
207 t.binary "binary"
208 t.datetime "submitted_at"
208 t.datetime "submitted_at"
209 t.datetime "compiled_at"
209 t.datetime "compiled_at"
210 t.text "compiler_message"
210 t.text "compiler_message"
211 t.datetime "graded_at"
211 t.datetime "graded_at"
212 t.integer "points"
212 t.integer "points"
213 t.text "grader_comment"
213 t.text "grader_comment"
214 t.integer "number"
214 t.integer "number"
215 t.string "source_filename"
215 t.string "source_filename"
216 t.float "max_runtime"
216 t.float "max_runtime"
217 t.integer "peak_memory"
217 t.integer "peak_memory"
218 t.integer "effective_code_length"
218 t.integer "effective_code_length"
219 t.string "ip_address"
219 t.string "ip_address"
220 t.index ["submitted_at"], name: "index_submissions_on_submitted_at"
220 t.index ["submitted_at"], name: "index_submissions_on_submitted_at"
221 t.index ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true
221 t.index ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true
222 t.index ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id"
222 t.index ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id"
223 end
223 end
224
224
225 - create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
225 + create_table "tags", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
226 t.string "name", null: false
226 t.string "name", null: false
227 t.text "description"
227 t.text "description"
228 t.boolean "public"
228 t.boolean "public"
229 t.datetime "created_at", null: false
229 t.datetime "created_at", null: false
230 t.datetime "updated_at", null: false
230 t.datetime "updated_at", null: false
231 end
231 end
232
232
233 - create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
233 + create_table "tasks", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
234 t.integer "submission_id"
234 t.integer "submission_id"
235 t.datetime "created_at"
235 t.datetime "created_at"
236 t.integer "status"
236 t.integer "status"
237 t.datetime "updated_at"
237 t.datetime "updated_at"
238 t.index ["submission_id"], name: "index_tasks_on_submission_id"
238 t.index ["submission_id"], name: "index_tasks_on_submission_id"
239 end
239 end
240
240
241 - create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
241 + create_table "test_pairs", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
242 t.integer "problem_id"
242 t.integer "problem_id"
243 t.text "input", limit: 16777215
243 t.text "input", limit: 16777215
244 t.text "solution", limit: 16777215
244 t.text "solution", limit: 16777215
245 - t.datetime "created_at", null: false
245 + t.datetime "created_at"
246 - t.datetime "updated_at", null: false
246 + t.datetime "updated_at"
247 end
247 end
248
248
249 - create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
249 + create_table "test_requests", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
250 t.integer "user_id"
250 t.integer "user_id"
251 t.integer "problem_id"
251 t.integer "problem_id"
252 t.integer "submission_id"
252 t.integer "submission_id"
253 t.string "input_file_name"
253 t.string "input_file_name"
254 t.string "output_file_name"
254 t.string "output_file_name"
255 t.string "running_stat"
255 t.string "running_stat"
256 t.integer "status"
256 t.integer "status"
257 - t.datetime "updated_at", null: false
257 + t.datetime "updated_at"
258 t.datetime "submitted_at"
258 t.datetime "submitted_at"
259 t.datetime "compiled_at"
259 t.datetime "compiled_at"
260 t.text "compiler_message"
260 t.text "compiler_message"
261 t.datetime "graded_at"
261 t.datetime "graded_at"
262 t.string "grader_comment"
262 t.string "grader_comment"
263 - t.datetime "created_at", null: false
263 + t.datetime "created_at"
264 t.float "running_time"
264 t.float "running_time"
265 t.string "exit_status"
265 t.string "exit_status"
266 t.integer "memory_usage"
266 t.integer "memory_usage"
267 t.index ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id"
267 t.index ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id"
268 end
268 end
269
269
270 - create_table "testcases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=latin1", force: :cascade do |t|
270 + create_table "testcases", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
271 t.integer "problem_id"
271 t.integer "problem_id"
272 t.integer "num"
272 t.integer "num"
273 t.integer "group"
273 t.integer "group"
274 t.integer "score"
274 t.integer "score"
275 t.text "input", limit: 4294967295
275 t.text "input", limit: 4294967295
276 t.text "sol", limit: 4294967295
276 t.text "sol", limit: 4294967295
277 t.datetime "created_at"
277 t.datetime "created_at"
278 t.datetime "updated_at"
278 t.datetime "updated_at"
279 t.index ["problem_id"], name: "index_testcases_on_problem_id"
279 t.index ["problem_id"], name: "index_testcases_on_problem_id"
280 end
280 end
281
281
282 - create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
282 + create_table "user_contest_stats", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
283 t.integer "user_id"
283 t.integer "user_id"
284 - t.datetime "started_at"
284 + t.timestamp "started_at"
285 - t.datetime "created_at", null: false
285 + t.datetime "created_at"
286 - t.datetime "updated_at", null: false
286 + t.datetime "updated_at"
287 t.boolean "forced_logout"
287 t.boolean "forced_logout"
288 end
288 end
289
289
290 - create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci", force: :cascade do |t|
290 + create_table "users", id: :integer, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci", force: :cascade do |t|
291 t.string "login", limit: 50
291 t.string "login", limit: 50
292 t.string "full_name"
292 t.string "full_name"
293 t.string "hashed_password"
293 t.string "hashed_password"
294 t.string "salt", limit: 5
294 t.string "salt", limit: 5
295 t.string "alias"
295 t.string "alias"
296 t.string "email"
296 t.string "email"
297 t.integer "site_id"
297 t.integer "site_id"
298 t.integer "country_id"
298 t.integer "country_id"
299 t.boolean "activated", default: false
299 t.boolean "activated", default: false
300 t.datetime "created_at"
300 t.datetime "created_at"
301 t.datetime "updated_at"
301 t.datetime "updated_at"
302 + t.string "section"
302 t.boolean "enabled", default: true
303 t.boolean "enabled", default: true
303 t.string "remark"
304 t.string "remark"
304 t.string "last_ip"
305 t.string "last_ip"
305 - t.string "section"
306 + t.integer "default_language"
306 t.index ["login"], name: "index_users_on_login", unique: true
307 t.index ["login"], name: "index_users_on_login", unique: true
307 end
308 end
308
309
309 add_foreign_key "problems_tags", "problems"
310 add_foreign_key "problems_tags", "problems"
310 add_foreign_key "problems_tags", "tags"
311 add_foreign_key "problems_tags", "tags"
311 end
312 end
You need to be logged in to leave comments. Login now