Description:
update
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r684:11ce8d963587 - - 2 files changed: 29 inserted, 28 deleted
@@ -21,192 +21,193 | |||||
|
21 |
|
21 | ||
|
22 | #in_place_edit_for :user, :alias_for_editing |
|
22 | #in_place_edit_for :user, :alias_for_editing |
|
23 | #in_place_edit_for :user, :email_for_editing |
|
23 | #in_place_edit_for :user, :email_for_editing |
|
24 |
|
24 | ||
|
25 | def index |
|
25 | def index |
|
26 | if !GraderConfiguration['system.user_setting_enabled'] |
|
26 | if !GraderConfiguration['system.user_setting_enabled'] |
|
27 | redirect_to :controller => 'main', :action => 'list' |
|
27 | redirect_to :controller => 'main', :action => 'list' |
|
28 | else |
|
28 | else |
|
29 | @user = User.find(session[:user_id]) |
|
29 | @user = User.find(session[:user_id]) |
|
30 | end |
|
30 | end |
|
31 | end |
|
31 | end |
|
32 |
|
32 | ||
|
33 | def chg_passwd |
|
33 | def chg_passwd |
|
34 | user = User.find(session[:user_id]) |
|
34 | user = User.find(session[:user_id]) |
|
35 | user.password = params[:passwd] |
|
35 | user.password = params[:passwd] |
|
36 | user.password_confirmation = params[:passwd_verify] |
|
36 | user.password_confirmation = params[:passwd_verify] |
|
37 | if user.save |
|
37 | if user.save |
|
38 | flash[:notice] = 'password changed' |
|
38 | flash[:notice] = 'password changed' |
|
39 | else |
|
39 | else |
|
40 | flash[:notice] = 'Error: password changing failed' |
|
40 | flash[:notice] = 'Error: password changing failed' |
|
41 | end |
|
41 | end |
|
42 | redirect_to :action => 'index' |
|
42 | redirect_to :action => 'index' |
|
43 | end |
|
43 | end |
|
44 |
|
44 | ||
|
45 | def new |
|
45 | def new |
|
46 | @user = User.new |
|
46 | @user = User.new |
|
47 | render :action => 'new', :layout => 'empty' |
|
47 | render :action => 'new', :layout => 'empty' |
|
48 | end |
|
48 | end |
|
49 |
|
49 | ||
|
50 | def register |
|
50 | def register |
|
51 | if(params[:cancel]) |
|
51 | if(params[:cancel]) |
|
52 | redirect_to :controller => 'main', :action => 'login' |
|
52 | redirect_to :controller => 'main', :action => 'login' |
|
53 | return |
|
53 | return |
|
54 | end |
|
54 | end |
|
55 | @user = User.new(user_params) |
|
55 | @user = User.new(user_params) |
|
56 | @user.password_confirmation = @user.password = User.random_password |
|
56 | @user.password_confirmation = @user.password = User.random_password |
|
57 | @user.activated = false |
|
57 | @user.activated = false |
|
58 | if (@user.valid?) and (@user.save) |
|
58 | if (@user.valid?) and (@user.save) |
|
59 | if send_confirmation_email(@user) |
|
59 | if send_confirmation_email(@user) |
|
60 | render :action => 'new_splash', :layout => 'empty' |
|
60 | render :action => 'new_splash', :layout => 'empty' |
|
61 | else |
|
61 | else |
|
62 | @admin_email = GraderConfiguration['system.admin_email'] |
|
62 | @admin_email = GraderConfiguration['system.admin_email'] |
|
63 | render :action => 'email_error', :layout => 'empty' |
|
63 | render :action => 'email_error', :layout => 'empty' |
|
64 | end |
|
64 | end |
|
65 | else |
|
65 | else |
|
66 | @user.errors.add(:base,"Email cannot be blank") if @user.email=='' |
|
66 | @user.errors.add(:base,"Email cannot be blank") if @user.email=='' |
|
67 | render :action => 'new', :layout => 'empty' |
|
67 | render :action => 'new', :layout => 'empty' |
|
68 | end |
|
68 | end |
|
69 | end |
|
69 | end |
|
70 |
|
70 | ||
|
71 | def confirm |
|
71 | def confirm |
|
72 | login = params[:login] |
|
72 | login = params[:login] |
|
73 | key = params[:activation] |
|
73 | key = params[:activation] |
|
74 | @user = User.find_by_login(login) |
|
74 | @user = User.find_by_login(login) |
|
75 | if (@user) and (@user.verify_activation_key(key)) |
|
75 | if (@user) and (@user.verify_activation_key(key)) |
|
76 | if @user.valid? # check uniquenss of email |
|
76 | if @user.valid? # check uniquenss of email |
|
77 | @user.activated = true |
|
77 | @user.activated = true |
|
78 | @user.save |
|
78 | @user.save |
|
79 | @result = :successful |
|
79 | @result = :successful |
|
80 | else |
|
80 | else |
|
81 | @result = :email_used |
|
81 | @result = :email_used |
|
82 | end |
|
82 | end |
|
83 | else |
|
83 | else |
|
84 | @result = :failed |
|
84 | @result = :failed |
|
85 | end |
|
85 | end |
|
86 | render :action => 'confirm', :layout => 'empty' |
|
86 | render :action => 'confirm', :layout => 'empty' |
|
87 | end |
|
87 | end |
|
88 |
|
88 | ||
|
89 | def forget |
|
89 | def forget |
|
90 | render :action => 'forget', :layout => 'empty' |
|
90 | render :action => 'forget', :layout => 'empty' |
|
91 | end |
|
91 | end |
|
92 |
|
92 | ||
|
93 | def retrieve_password |
|
93 | def retrieve_password |
|
94 | email = params[:email] |
|
94 | email = params[:email] |
|
95 | user = User.find_by_email(email) |
|
95 | user = User.find_by_email(email) |
|
96 | if user |
|
96 | if user |
|
97 | last_updated_time = user.updated_at || user.created_at || (Time.now.gmtime - 1.hour) |
|
97 | last_updated_time = user.updated_at || user.created_at || (Time.now.gmtime - 1.hour) |
|
98 | if last_updated_time > Time.now.gmtime - 5.minutes |
|
98 | if last_updated_time > Time.now.gmtime - 5.minutes |
|
99 | flash[:notice] = 'The account has recently created or new password has recently been requested. Please wait for 5 minutes' |
|
99 | flash[:notice] = 'The account has recently created or new password has recently been requested. Please wait for 5 minutes' |
|
100 | else |
|
100 | else |
|
101 | user.password = user.password_confirmation = User.random_password |
|
101 | user.password = user.password_confirmation = User.random_password |
|
102 | user.save |
|
102 | user.save |
|
103 | send_new_password_email(user) |
|
103 | send_new_password_email(user) |
|
104 | flash[:notice] = 'New password has been mailed to you.' |
|
104 | flash[:notice] = 'New password has been mailed to you.' |
|
105 | end |
|
105 | end |
|
106 | else |
|
106 | else |
|
107 | flash[:notice] = I18n.t 'registration.password_retrieval.no_email' |
|
107 | flash[:notice] = I18n.t 'registration.password_retrieval.no_email' |
|
108 | end |
|
108 | end |
|
109 | redirect_to :action => 'forget' |
|
109 | redirect_to :action => 'forget' |
|
110 | end |
|
110 | end |
|
111 |
|
111 | ||
|
112 | def stat |
|
112 | def stat |
|
113 | @user = User.find(params[:id]) |
|
113 | @user = User.find(params[:id]) |
|
114 | @submission = Submission.joins(:problem).where(user_id: params[:id]) |
|
114 | @submission = Submission.joins(:problem).where(user_id: params[:id]) |
|
115 | @submission = @submission.where('problems.available = true') unless current_user.admin? |
|
115 | @submission = @submission.where('problems.available = true') unless current_user.admin? |
|
116 |
|
116 | ||
|
|
117 | + | ||
|
117 | range = 120 |
|
118 | range = 120 |
|
118 | @histogram = { data: Array.new(range,0), summary: {} } |
|
119 | @histogram = { data: Array.new(range,0), summary: {} } |
|
119 | @summary = {count: 0, solve: 0, attempt: 0} |
|
120 | @summary = {count: 0, solve: 0, attempt: 0} |
|
120 | problem = Hash.new(0) |
|
121 | problem = Hash.new(0) |
|
121 |
|
122 | ||
|
122 | @submission.find_each do |sub| |
|
123 | @submission.find_each do |sub| |
|
123 | #histogram |
|
124 | #histogram |
|
124 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
125 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
125 | @histogram[:data][d.to_i] += 1 if d < range |
|
126 | @histogram[:data][d.to_i] += 1 if d < range |
|
126 |
|
127 | ||
|
127 | @summary[:count] += 1 |
|
128 | @summary[:count] += 1 |
|
128 | next unless sub.problem |
|
129 | next unless sub.problem |
|
129 | problem[sub.problem] = [problem[sub.problem], ( (sub.try(:points) || 0) >= sub.problem.full_score) ? 1 : 0].max |
|
130 | problem[sub.problem] = [problem[sub.problem], ( (sub.try(:points) || 0) >= sub.problem.full_score) ? 1 : 0].max |
|
130 | end |
|
131 | end |
|
131 |
|
132 | ||
|
132 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
133 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
133 | @summary[:attempt] = problem.count |
|
134 | @summary[:attempt] = problem.count |
|
134 | problem.each_value { |v| @summary[:solve] += 1 if v == 1 } |
|
135 | problem.each_value { |v| @summary[:solve] += 1 if v == 1 } |
|
135 | end |
|
136 | end |
|
136 |
|
137 | ||
|
137 | def toggle_activate |
|
138 | def toggle_activate |
|
138 | @user = User.find(params[:id]) |
|
139 | @user = User.find(params[:id]) |
|
139 | @user.update_attributes( activated: !@user.activated? ) |
|
140 | @user.update_attributes( activated: !@user.activated? ) |
|
140 | respond_to do |format| |
|
141 | respond_to do |format| |
|
141 | format.js { render partial: 'toggle_button', |
|
142 | format.js { render partial: 'toggle_button', |
|
142 | locals: {button_id: "#toggle_activate_user_#{@user.id}",button_on: @user.activated? } } |
|
143 | locals: {button_id: "#toggle_activate_user_#{@user.id}",button_on: @user.activated? } } |
|
143 | end |
|
144 | end |
|
144 | end |
|
145 | end |
|
145 |
|
146 | ||
|
146 | def toggle_enable |
|
147 | def toggle_enable |
|
147 | @user = User.find(params[:id]) |
|
148 | @user = User.find(params[:id]) |
|
148 | @user.update_attributes( enabled: !@user.enabled? ) |
|
149 | @user.update_attributes( enabled: !@user.enabled? ) |
|
149 | respond_to do |format| |
|
150 | respond_to do |format| |
|
150 | format.js { render partial: 'toggle_button', |
|
151 | format.js { render partial: 'toggle_button', |
|
151 | locals: {button_id: "#toggle_enable_user_#{@user.id}",button_on: @user.enabled? } } |
|
152 | locals: {button_id: "#toggle_enable_user_#{@user.id}",button_on: @user.enabled? } } |
|
152 | end |
|
153 | end |
|
153 | end |
|
154 | end |
|
154 |
|
155 | ||
|
155 | protected |
|
156 | protected |
|
156 |
|
157 | ||
|
157 | def verify_online_registration |
|
158 | def verify_online_registration |
|
158 | if !GraderConfiguration['system.online_registration'] |
|
159 | if !GraderConfiguration['system.online_registration'] |
|
159 | redirect_to :controller => 'main', :action => 'login' |
|
160 | redirect_to :controller => 'main', :action => 'login' |
|
160 | end |
|
161 | end |
|
161 | end |
|
162 | end |
|
162 |
|
163 | ||
|
163 | def send_confirmation_email(user) |
|
164 | def send_confirmation_email(user) |
|
164 | contest_name = GraderConfiguration['contest.name'] |
|
165 | contest_name = GraderConfiguration['contest.name'] |
|
165 | activation_url = url_for(:action => 'confirm', |
|
166 | activation_url = url_for(:action => 'confirm', |
|
166 | :login => user.login, |
|
167 | :login => user.login, |
|
167 | :activation => user.activation_key) |
|
168 | :activation => user.activation_key) |
|
168 | home_url = url_for(:controller => 'main', :action => 'index') |
|
169 | home_url = url_for(:controller => 'main', :action => 'index') |
|
169 | mail_subject = "[#{contest_name}] Confirmation" |
|
170 | mail_subject = "[#{contest_name}] Confirmation" |
|
170 | mail_body = t('registration.email_body', { |
|
171 | mail_body = t('registration.email_body', { |
|
171 | :full_name => user.full_name, |
|
172 | :full_name => user.full_name, |
|
172 | :contest_name => contest_name, |
|
173 | :contest_name => contest_name, |
|
173 | :login => user.login, |
|
174 | :login => user.login, |
|
174 | :password => user.password, |
|
175 | :password => user.password, |
|
175 | :activation_url => activation_url, |
|
176 | :activation_url => activation_url, |
|
176 | :admin_email => GraderConfiguration['system.admin_email'] |
|
177 | :admin_email => GraderConfiguration['system.admin_email'] |
|
177 | }) |
|
178 | }) |
|
178 |
|
179 | ||
|
179 | logger.info mail_body |
|
180 | logger.info mail_body |
|
180 |
|
181 | ||
|
181 | send_mail(user.email, mail_subject, mail_body) |
|
182 | send_mail(user.email, mail_subject, mail_body) |
|
182 | end |
|
183 | end |
|
183 |
|
184 | ||
|
184 | def send_new_password_email(user) |
|
185 | def send_new_password_email(user) |
|
185 | contest_name = GraderConfiguration['contest.name'] |
|
186 | contest_name = GraderConfiguration['contest.name'] |
|
186 | mail_subject = "[#{contest_name}] Password recovery" |
|
187 | mail_subject = "[#{contest_name}] Password recovery" |
|
187 | mail_body = t('registration.password_retrieval.email_body', { |
|
188 | mail_body = t('registration.password_retrieval.email_body', { |
|
188 | :full_name => user.full_name, |
|
189 | :full_name => user.full_name, |
|
189 | :contest_name => contest_name, |
|
190 | :contest_name => contest_name, |
|
190 | :login => user.login, |
|
191 | :login => user.login, |
|
191 | :password => user.password, |
|
192 | :password => user.password, |
|
192 | :admin_email => GraderConfiguration['system.admin_email'] |
|
193 | :admin_email => GraderConfiguration['system.admin_email'] |
|
193 | }) |
|
194 | }) |
|
194 |
|
195 | ||
|
195 | logger.info mail_body |
|
196 | logger.info mail_body |
|
196 |
|
197 | ||
|
197 | send_mail(user.email, mail_subject, mail_body) |
|
198 | send_mail(user.email, mail_subject, mail_body) |
|
198 | end |
|
199 | end |
|
199 |
|
200 | ||
|
200 | # allow viewing of regular user profile only when options allow so |
|
201 | # allow viewing of regular user profile only when options allow so |
|
201 | # only admins can view admins profile |
|
202 | # only admins can view admins profile |
|
202 | def profile_authorization |
|
203 | def profile_authorization |
|
203 | #if view admins' profile, allow only admin |
|
204 | #if view admins' profile, allow only admin |
|
204 | return false unless(params[:id]) |
|
205 | return false unless(params[:id]) |
|
205 | user = User.find(params[:id]) |
|
206 | user = User.find(params[:id]) |
|
206 | return false unless user |
|
207 | return false unless user |
|
207 | return admin_authorization if user.admin? |
|
208 | return admin_authorization if user.admin? |
|
208 | return true if GraderConfiguration["right.user_view_submission"] |
|
209 | return true if GraderConfiguration["right.user_view_submission"] |
|
209 |
|
210 | ||
|
210 | #finally, we allow only admin |
|
211 | #finally, we allow only admin |
|
211 | admin_authorization |
|
212 | admin_authorization |
|
212 | end |
|
213 | end |
@@ -1,283 +1,283 | |||||
|
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 that you 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(version: 20170427070345) do |
|
14 | ActiveRecord::Schema.define(version: 20170427070345) do |
|
15 |
|
15 | ||
|
16 | create_table "announcements", force: :cascade do |t| |
|
16 | create_table "announcements", force: :cascade do |t| |
|
17 | t.string "author", limit: 255 |
|
17 | t.string "author", limit: 255 |
|
18 |
- t.text "body", limit: |
|
18 | + t.text "body", limit: 16777215 |
|
19 | t.boolean "published" |
|
19 | t.boolean "published" |
|
20 | - t.datetime "created_at", null: false |
|
20 | + t.datetime "created_at", null: false |
|
21 | - t.datetime "updated_at", null: false |
|
21 | + t.datetime "updated_at", null: false |
|
22 | - t.boolean "frontpage", default: false |
|
22 | + t.boolean "frontpage", default: false |
|
23 | - t.boolean "contest_only", default: false |
|
23 | + t.boolean "contest_only", default: false |
|
24 | t.string "title", limit: 255 |
|
24 | t.string "title", limit: 255 |
|
25 | t.string "notes", limit: 255 |
|
25 | t.string "notes", limit: 255 |
|
26 | end |
|
26 | end |
|
27 |
|
27 | ||
|
28 | create_table "contests", force: :cascade do |t| |
|
28 | create_table "contests", force: :cascade do |t| |
|
29 | t.string "title", limit: 255 |
|
29 | t.string "title", limit: 255 |
|
30 | t.boolean "enabled" |
|
30 | t.boolean "enabled" |
|
31 | t.datetime "created_at", null: false |
|
31 | t.datetime "created_at", null: false |
|
32 | t.datetime "updated_at", null: false |
|
32 | t.datetime "updated_at", null: false |
|
33 | t.string "name", limit: 255 |
|
33 | t.string "name", limit: 255 |
|
34 | end |
|
34 | end |
|
35 |
|
35 | ||
|
36 | create_table "contests_problems", id: false, force: :cascade do |t| |
|
36 | create_table "contests_problems", id: false, force: :cascade do |t| |
|
37 | t.integer "contest_id", limit: 4 |
|
37 | t.integer "contest_id", limit: 4 |
|
38 | t.integer "problem_id", limit: 4 |
|
38 | t.integer "problem_id", limit: 4 |
|
39 | end |
|
39 | end |
|
40 |
|
40 | ||
|
41 | create_table "contests_users", id: false, force: :cascade do |t| |
|
41 | create_table "contests_users", id: false, force: :cascade do |t| |
|
42 | t.integer "contest_id", limit: 4 |
|
42 | t.integer "contest_id", limit: 4 |
|
43 | t.integer "user_id", limit: 4 |
|
43 | t.integer "user_id", limit: 4 |
|
44 | end |
|
44 | end |
|
45 |
|
45 | ||
|
46 | create_table "countries", force: :cascade do |t| |
|
46 | create_table "countries", force: :cascade do |t| |
|
47 | t.string "name", limit: 255 |
|
47 | t.string "name", limit: 255 |
|
48 | t.datetime "created_at", null: false |
|
48 | t.datetime "created_at", null: false |
|
49 | t.datetime "updated_at", null: false |
|
49 | t.datetime "updated_at", null: false |
|
50 | end |
|
50 | end |
|
51 |
|
51 | ||
|
52 | create_table "descriptions", force: :cascade do |t| |
|
52 | create_table "descriptions", force: :cascade do |t| |
|
53 |
- t.text "body", limit: |
|
53 | + t.text "body", limit: 16777215 |
|
54 | t.boolean "markdowned" |
|
54 | t.boolean "markdowned" |
|
55 | - t.datetime "created_at", null: false |
|
55 | + t.datetime "created_at", null: false |
|
56 | - t.datetime "updated_at", null: false |
|
56 | + t.datetime "updated_at", null: false |
|
57 | end |
|
57 | end |
|
58 |
|
58 | ||
|
59 | create_table "grader_configurations", force: :cascade do |t| |
|
59 | create_table "grader_configurations", force: :cascade do |t| |
|
60 | t.string "key", limit: 255 |
|
60 | t.string "key", limit: 255 |
|
61 | t.string "value_type", limit: 255 |
|
61 | t.string "value_type", limit: 255 |
|
62 | t.string "value", limit: 255 |
|
62 | t.string "value", limit: 255 |
|
63 | - t.datetime "created_at", null: false |
|
63 | + t.datetime "created_at", null: false |
|
64 | - t.datetime "updated_at", null: false |
|
64 | + t.datetime "updated_at", null: false |
|
65 |
- t.text "description", limit: |
|
65 | + t.text "description", limit: 16777215 |
|
66 | end |
|
66 | end |
|
67 |
|
67 | ||
|
68 | create_table "grader_processes", force: :cascade do |t| |
|
68 | create_table "grader_processes", force: :cascade do |t| |
|
69 | t.string "host", limit: 255 |
|
69 | t.string "host", limit: 255 |
|
70 | t.integer "pid", limit: 4 |
|
70 | t.integer "pid", limit: 4 |
|
71 | t.string "mode", limit: 255 |
|
71 | t.string "mode", limit: 255 |
|
72 | t.boolean "active" |
|
72 | t.boolean "active" |
|
73 | t.datetime "created_at", null: false |
|
73 | t.datetime "created_at", null: false |
|
74 | t.datetime "updated_at", null: false |
|
74 | t.datetime "updated_at", null: false |
|
75 | t.integer "task_id", limit: 4 |
|
75 | t.integer "task_id", limit: 4 |
|
76 | t.string "task_type", limit: 255 |
|
76 | t.string "task_type", limit: 255 |
|
77 | t.boolean "terminated" |
|
77 | t.boolean "terminated" |
|
78 | end |
|
78 | end |
|
79 |
|
79 | ||
|
80 | add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid", using: :btree |
|
80 | add_index "grader_processes", ["host", "pid"], name: "index_grader_processes_on_ip_and_pid", using: :btree |
|
81 |
|
81 | ||
|
82 | create_table "heart_beats", force: :cascade do |t| |
|
82 | create_table "heart_beats", force: :cascade do |t| |
|
83 | t.integer "user_id", limit: 4 |
|
83 | t.integer "user_id", limit: 4 |
|
84 | t.string "ip_address", limit: 255 |
|
84 | t.string "ip_address", limit: 255 |
|
85 | t.datetime "created_at", null: false |
|
85 | t.datetime "created_at", null: false |
|
86 | t.datetime "updated_at", null: false |
|
86 | t.datetime "updated_at", null: false |
|
87 | t.string "status", limit: 255 |
|
87 | t.string "status", limit: 255 |
|
88 | end |
|
88 | end |
|
89 |
|
89 | ||
|
90 | add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at", using: :btree |
|
90 | add_index "heart_beats", ["updated_at"], name: "index_heart_beats_on_updated_at", using: :btree |
|
91 |
|
91 | ||
|
92 | create_table "languages", force: :cascade do |t| |
|
92 | create_table "languages", force: :cascade do |t| |
|
93 | t.string "name", limit: 10 |
|
93 | t.string "name", limit: 10 |
|
94 | t.string "pretty_name", limit: 255 |
|
94 | t.string "pretty_name", limit: 255 |
|
95 | t.string "ext", limit: 10 |
|
95 | t.string "ext", limit: 10 |
|
96 | t.string "common_ext", limit: 255 |
|
96 | t.string "common_ext", limit: 255 |
|
97 | end |
|
97 | end |
|
98 |
|
98 | ||
|
99 | create_table "logins", force: :cascade do |t| |
|
99 | create_table "logins", force: :cascade do |t| |
|
100 | t.integer "user_id", limit: 4 |
|
100 | t.integer "user_id", limit: 4 |
|
101 | t.string "ip_address", limit: 255 |
|
101 | t.string "ip_address", limit: 255 |
|
102 | t.datetime "created_at", null: false |
|
102 | t.datetime "created_at", null: false |
|
103 | t.datetime "updated_at", null: false |
|
103 | t.datetime "updated_at", null: false |
|
104 | end |
|
104 | end |
|
105 |
|
105 | ||
|
106 | create_table "messages", force: :cascade do |t| |
|
106 | create_table "messages", force: :cascade do |t| |
|
107 | t.integer "sender_id", limit: 4 |
|
107 | t.integer "sender_id", limit: 4 |
|
108 | t.integer "receiver_id", limit: 4 |
|
108 | t.integer "receiver_id", limit: 4 |
|
109 | t.integer "replying_message_id", limit: 4 |
|
109 | t.integer "replying_message_id", limit: 4 |
|
110 |
- t.text "body", limit: |
|
110 | + t.text "body", limit: 16777215 |
|
111 | t.boolean "replied" |
|
111 | t.boolean "replied" |
|
112 | - t.datetime "created_at", null: false |
|
112 | + t.datetime "created_at", null: false |
|
113 | - t.datetime "updated_at", null: false |
|
113 | + t.datetime "updated_at", null: false |
|
114 | end |
|
114 | end |
|
115 |
|
115 | ||
|
116 | create_table "problems", force: :cascade do |t| |
|
116 | create_table "problems", force: :cascade do |t| |
|
117 | t.string "name", limit: 30 |
|
117 | t.string "name", limit: 30 |
|
118 | t.string "full_name", limit: 255 |
|
118 | t.string "full_name", limit: 255 |
|
119 | t.integer "full_score", limit: 4 |
|
119 | t.integer "full_score", limit: 4 |
|
120 | t.date "date_added" |
|
120 | t.date "date_added" |
|
121 | t.boolean "available" |
|
121 | t.boolean "available" |
|
122 | t.string "url", limit: 255 |
|
122 | t.string "url", limit: 255 |
|
123 | t.integer "description_id", limit: 4 |
|
123 | t.integer "description_id", limit: 4 |
|
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", limit: 255 |
|
126 | t.string "description_filename", limit: 255 |
|
127 | t.boolean "view_testcase" |
|
127 | t.boolean "view_testcase" |
|
128 | end |
|
128 | end |
|
129 |
|
129 | ||
|
130 | create_table "rights", force: :cascade do |t| |
|
130 | create_table "rights", force: :cascade do |t| |
|
131 | t.string "name", limit: 255 |
|
131 | t.string "name", limit: 255 |
|
132 | t.string "controller", limit: 255 |
|
132 | t.string "controller", limit: 255 |
|
133 | t.string "action", limit: 255 |
|
133 | t.string "action", limit: 255 |
|
134 | end |
|
134 | end |
|
135 |
|
135 | ||
|
136 | create_table "rights_roles", id: false, force: :cascade do |t| |
|
136 | create_table "rights_roles", id: false, force: :cascade do |t| |
|
137 | t.integer "right_id", limit: 4 |
|
137 | t.integer "right_id", limit: 4 |
|
138 | t.integer "role_id", limit: 4 |
|
138 | t.integer "role_id", limit: 4 |
|
139 | end |
|
139 | end |
|
140 |
|
140 | ||
|
141 | add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id", using: :btree |
|
141 | add_index "rights_roles", ["role_id"], name: "index_rights_roles_on_role_id", using: :btree |
|
142 |
|
142 | ||
|
143 | create_table "roles", force: :cascade do |t| |
|
143 | create_table "roles", force: :cascade do |t| |
|
144 | t.string "name", limit: 255 |
|
144 | t.string "name", limit: 255 |
|
145 | end |
|
145 | end |
|
146 |
|
146 | ||
|
147 | create_table "roles_users", id: false, force: :cascade do |t| |
|
147 | create_table "roles_users", id: false, force: :cascade do |t| |
|
148 | t.integer "role_id", limit: 4 |
|
148 | t.integer "role_id", limit: 4 |
|
149 | t.integer "user_id", limit: 4 |
|
149 | t.integer "user_id", limit: 4 |
|
150 | end |
|
150 | end |
|
151 |
|
151 | ||
|
152 | add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id", using: :btree |
|
152 | add_index "roles_users", ["user_id"], name: "index_roles_users_on_user_id", using: :btree |
|
153 |
|
153 | ||
|
154 | create_table "sessions", force: :cascade do |t| |
|
154 | create_table "sessions", force: :cascade do |t| |
|
155 | t.string "session_id", limit: 255 |
|
155 | t.string "session_id", limit: 255 |
|
156 |
- t.text "data", limit: |
|
156 | + t.text "data", limit: 16777215 |
|
157 | t.datetime "updated_at" |
|
157 | t.datetime "updated_at" |
|
158 | end |
|
158 | end |
|
159 |
|
159 | ||
|
160 | add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree |
|
160 | add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree |
|
161 | add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree |
|
161 | add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree |
|
162 |
|
162 | ||
|
163 | create_table "sites", force: :cascade do |t| |
|
163 | create_table "sites", force: :cascade do |t| |
|
164 | t.string "name", limit: 255 |
|
164 | t.string "name", limit: 255 |
|
165 | t.boolean "started" |
|
165 | t.boolean "started" |
|
166 | t.datetime "start_time" |
|
166 | t.datetime "start_time" |
|
167 | t.datetime "created_at", null: false |
|
167 | t.datetime "created_at", null: false |
|
168 | t.datetime "updated_at", null: false |
|
168 | t.datetime "updated_at", null: false |
|
169 | t.integer "country_id", limit: 4 |
|
169 | t.integer "country_id", limit: 4 |
|
170 | t.string "password", limit: 255 |
|
170 | t.string "password", limit: 255 |
|
171 | end |
|
171 | end |
|
172 |
|
172 | ||
|
173 | create_table "submission_view_logs", force: :cascade do |t| |
|
173 | create_table "submission_view_logs", force: :cascade do |t| |
|
174 | t.integer "user_id", limit: 4 |
|
174 | t.integer "user_id", limit: 4 |
|
175 | t.integer "submission_id", limit: 4 |
|
175 | t.integer "submission_id", limit: 4 |
|
176 | t.datetime "created_at", null: false |
|
176 | t.datetime "created_at", null: false |
|
177 | t.datetime "updated_at", null: false |
|
177 | t.datetime "updated_at", null: false |
|
178 | end |
|
178 | end |
|
179 |
|
179 | ||
|
180 | create_table "submissions", force: :cascade do |t| |
|
180 | create_table "submissions", force: :cascade do |t| |
|
181 | t.integer "user_id", limit: 4 |
|
181 | t.integer "user_id", limit: 4 |
|
182 | t.integer "problem_id", limit: 4 |
|
182 | t.integer "problem_id", limit: 4 |
|
183 | t.integer "language_id", limit: 4 |
|
183 | t.integer "language_id", limit: 4 |
|
184 |
- t.text "source", limit: |
|
184 | + t.text "source", limit: 16777215 |
|
185 | t.binary "binary", limit: 65535 |
|
185 | t.binary "binary", limit: 65535 |
|
186 | t.datetime "submitted_at" |
|
186 | t.datetime "submitted_at" |
|
187 | t.datetime "compiled_at" |
|
187 | t.datetime "compiled_at" |
|
188 |
- t.text "compiler_message", limit: |
|
188 | + t.text "compiler_message", limit: 16777215 |
|
189 | t.datetime "graded_at" |
|
189 | t.datetime "graded_at" |
|
190 | t.integer "points", limit: 4 |
|
190 | t.integer "points", limit: 4 |
|
191 |
- t.text "grader_comment", limit: |
|
191 | + t.text "grader_comment", limit: 16777215 |
|
192 | t.integer "number", limit: 4 |
|
192 | t.integer "number", limit: 4 |
|
193 | t.string "source_filename", limit: 255 |
|
193 | t.string "source_filename", limit: 255 |
|
194 | t.float "max_runtime", limit: 24 |
|
194 | t.float "max_runtime", limit: 24 |
|
195 | t.integer "peak_memory", limit: 4 |
|
195 | t.integer "peak_memory", limit: 4 |
|
196 | t.integer "effective_code_length", limit: 4 |
|
196 | t.integer "effective_code_length", limit: 4 |
|
197 | t.string "ip_address", limit: 255 |
|
197 | t.string "ip_address", limit: 255 |
|
198 | end |
|
198 | end |
|
199 |
|
199 | ||
|
200 | add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true, using: :btree |
|
200 | add_index "submissions", ["user_id", "problem_id", "number"], name: "index_submissions_on_user_id_and_problem_id_and_number", unique: true, using: :btree |
|
201 | add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree |
|
201 | add_index "submissions", ["user_id", "problem_id"], name: "index_submissions_on_user_id_and_problem_id", using: :btree |
|
202 |
|
202 | ||
|
203 | create_table "tasks", force: :cascade do |t| |
|
203 | create_table "tasks", force: :cascade do |t| |
|
204 | t.integer "submission_id", limit: 4 |
|
204 | t.integer "submission_id", limit: 4 |
|
205 | t.datetime "created_at" |
|
205 | t.datetime "created_at" |
|
206 | t.integer "status", limit: 4 |
|
206 | t.integer "status", limit: 4 |
|
207 | t.datetime "updated_at" |
|
207 | t.datetime "updated_at" |
|
208 | end |
|
208 | end |
|
209 |
|
209 | ||
|
210 | add_index "tasks", ["submission_id"], name: "index_tasks_on_submission_id", using: :btree |
|
210 | add_index "tasks", ["submission_id"], name: "index_tasks_on_submission_id", using: :btree |
|
211 |
|
211 | ||
|
212 | create_table "test_pairs", force: :cascade do |t| |
|
212 | create_table "test_pairs", force: :cascade do |t| |
|
213 | t.integer "problem_id", limit: 4 |
|
213 | t.integer "problem_id", limit: 4 |
|
214 |
- t.text "input", limit: |
|
214 | + t.text "input", limit: 4294967295 |
|
215 |
- t.text "solution", limit: |
|
215 | + t.text "solution", limit: 4294967295 |
|
216 | - t.datetime "created_at", null: false |
|
216 | + t.datetime "created_at", null: false |
|
217 | - t.datetime "updated_at", null: false |
|
217 | + t.datetime "updated_at", null: false |
|
218 | end |
|
218 | end |
|
219 |
|
219 | ||
|
220 | create_table "test_requests", force: :cascade do |t| |
|
220 | create_table "test_requests", force: :cascade do |t| |
|
221 | t.integer "user_id", limit: 4 |
|
221 | t.integer "user_id", limit: 4 |
|
222 | t.integer "problem_id", limit: 4 |
|
222 | t.integer "problem_id", limit: 4 |
|
223 | t.integer "submission_id", limit: 4 |
|
223 | t.integer "submission_id", limit: 4 |
|
224 | t.string "input_file_name", limit: 255 |
|
224 | t.string "input_file_name", limit: 255 |
|
225 | t.string "output_file_name", limit: 255 |
|
225 | t.string "output_file_name", limit: 255 |
|
226 | t.string "running_stat", limit: 255 |
|
226 | t.string "running_stat", limit: 255 |
|
227 | t.integer "status", limit: 4 |
|
227 | t.integer "status", limit: 4 |
|
228 | - t.datetime "updated_at", null: false |
|
228 | + t.datetime "updated_at", null: false |
|
229 | t.datetime "submitted_at" |
|
229 | t.datetime "submitted_at" |
|
230 | t.datetime "compiled_at" |
|
230 | t.datetime "compiled_at" |
|
231 |
- t.text "compiler_message", limit: |
|
231 | + t.text "compiler_message", limit: 16777215 |
|
232 | t.datetime "graded_at" |
|
232 | t.datetime "graded_at" |
|
233 | t.string "grader_comment", limit: 255 |
|
233 | t.string "grader_comment", limit: 255 |
|
234 | - t.datetime "created_at", null: false |
|
234 | + t.datetime "created_at", null: false |
|
235 | t.float "running_time", limit: 24 |
|
235 | t.float "running_time", limit: 24 |
|
236 | t.string "exit_status", limit: 255 |
|
236 | t.string "exit_status", limit: 255 |
|
237 | t.integer "memory_usage", limit: 4 |
|
237 | t.integer "memory_usage", limit: 4 |
|
238 | end |
|
238 | end |
|
239 |
|
239 | ||
|
240 | add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id", using: :btree |
|
240 | add_index "test_requests", ["user_id", "problem_id"], name: "index_test_requests_on_user_id_and_problem_id", using: :btree |
|
241 |
|
241 | ||
|
242 | create_table "testcases", force: :cascade do |t| |
|
242 | create_table "testcases", force: :cascade do |t| |
|
243 | t.integer "problem_id", limit: 4 |
|
243 | t.integer "problem_id", limit: 4 |
|
244 | t.integer "num", limit: 4 |
|
244 | t.integer "num", limit: 4 |
|
245 | t.integer "group", limit: 4 |
|
245 | t.integer "group", limit: 4 |
|
246 | t.integer "score", limit: 4 |
|
246 | t.integer "score", limit: 4 |
|
247 | t.text "input", limit: 4294967295 |
|
247 | t.text "input", limit: 4294967295 |
|
248 | t.text "sol", limit: 4294967295 |
|
248 | t.text "sol", limit: 4294967295 |
|
249 | - t.datetime "created_at" |
|
249 | + t.datetime "created_at", null: false |
|
250 | - t.datetime "updated_at" |
|
250 | + t.datetime "updated_at", null: false |
|
251 | end |
|
251 | end |
|
252 |
|
252 | ||
|
253 | add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id", using: :btree |
|
253 | add_index "testcases", ["problem_id"], name: "index_testcases_on_problem_id", using: :btree |
|
254 |
|
254 | ||
|
255 | create_table "user_contest_stats", force: :cascade do |t| |
|
255 | create_table "user_contest_stats", force: :cascade do |t| |
|
256 | t.integer "user_id", limit: 4 |
|
256 | t.integer "user_id", limit: 4 |
|
257 | t.datetime "started_at" |
|
257 | t.datetime "started_at" |
|
258 | t.datetime "created_at", null: false |
|
258 | t.datetime "created_at", null: false |
|
259 | t.datetime "updated_at", null: false |
|
259 | t.datetime "updated_at", null: false |
|
260 | t.boolean "forced_logout" |
|
260 | t.boolean "forced_logout" |
|
261 | end |
|
261 | end |
|
262 |
|
262 | ||
|
263 | create_table "users", force: :cascade do |t| |
|
263 | create_table "users", force: :cascade do |t| |
|
264 | t.string "login", limit: 50 |
|
264 | t.string "login", limit: 50 |
|
265 | t.string "full_name", limit: 255 |
|
265 | t.string "full_name", limit: 255 |
|
266 | t.string "hashed_password", limit: 255 |
|
266 | t.string "hashed_password", limit: 255 |
|
267 | t.string "salt", limit: 5 |
|
267 | t.string "salt", limit: 5 |
|
268 | t.string "alias", limit: 255 |
|
268 | t.string "alias", limit: 255 |
|
269 | t.string "email", limit: 255 |
|
269 | t.string "email", limit: 255 |
|
270 | t.integer "site_id", limit: 4 |
|
270 | t.integer "site_id", limit: 4 |
|
271 | t.integer "country_id", limit: 4 |
|
271 | t.integer "country_id", limit: 4 |
|
272 | t.boolean "activated", default: false |
|
272 | t.boolean "activated", default: false |
|
273 | t.datetime "created_at" |
|
273 | t.datetime "created_at" |
|
274 | t.datetime "updated_at" |
|
274 | t.datetime "updated_at" |
|
|
275 | + t.string "section", limit: 255 | ||
|
275 | t.boolean "enabled", default: true |
|
276 | t.boolean "enabled", default: true |
|
276 | t.string "remark", limit: 255 |
|
277 | t.string "remark", limit: 255 |
|
277 | t.string "last_ip", limit: 255 |
|
278 | t.string "last_ip", limit: 255 |
|
278 | - t.string "section", limit: 255 |
|
||
|
279 | end |
|
279 | end |
|
280 |
|
280 | ||
|
281 | add_index "users", ["login"], name: "index_users_on_login", unique: true, using: :btree |
|
281 | add_index "users", ["login"], name: "index_users_on_login", unique: true, using: :btree |
|
282 |
|
282 | ||
|
283 | end |
|
283 | end |
You need to be logged in to leave comments.
Login now