Description:
Merge pull request #28 from paphonb/change-default-language
allow users to change default submission language
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r806:18ecb4364a64 - - 6 files changed: 91 inserted, 68 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 |
@@ -50,6 +50,17 | |||||
|
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' |
@@ -26,7 +26,7 | |||||
|
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 |
@@ -1,6 +1,5 | |||||
|
1 |
|
1 | ||
|
2 | .container-fluid |
|
2 | .container-fluid |
|
3 | - = form_tag :action => 'chg_passwd', :method => 'post' do |
|
||
|
4 |
|
|
3 | .row |
|
5 |
|
|
4 | .col-md-6 |
|
6 |
|
|
5 | %h1 Your account settings |
@@ -10,14 +9,20 | |||||
|
10 |
|
|
9 | .form-group |
|
11 |
|
|
10 | %label{:for => "full_name"} Full name |
|
12 |
|
|
11 | =@user.full_name |
|
|
12 | + = form_tag :action => 'chg_default_language', :method => 'post' do | ||
|
|
13 | + %h2 Change default submission language | ||
|
|
14 | + .form-group | ||
|
|
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" | ||
|
|
16 | + = submit_tag 'Save', class: 'btn btn-success' | ||
|
|
17 | + %br | ||
|
|
18 | + = form_tag :action => 'chg_passwd', :method => 'post' do | ||
|
|
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 |
@@ -85,6 +85,7 | |||||
|
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 |
@@ -10,14 +10,14 | |||||
|
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_ |
|
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 |
|
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" |
|
19 | + t.datetime "created_at" |
|
20 |
- t.datetime "updated_at" |
|
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" |
@@ -25,112 +25,112 | |||||
|
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 |
|
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" |
|
31 | + t.datetime "created_at" |
|
32 |
- t.datetime "updated_at" |
|
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 |
|
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 |
|
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 |
|
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" |
|
48 | + t.datetime "created_at" |
|
49 |
- t.datetime "updated_at" |
|
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 |
|
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" |
|
55 | + t.datetime "created_at" |
|
56 |
- t.datetime "updated_at" |
|
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 |
|
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" |
|
63 | + t.datetime "created_at" |
|
64 |
- t.datetime "updated_at" |
|
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 |
|
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" |
|
73 | + t.datetime "created_at" |
|
74 |
- t.datetime "updated_at" |
|
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_ |
|
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= |
|
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= |
|
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= |
|
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 |
|
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" |
|
102 | + t.datetime "created_at" |
|
103 |
- t.datetime "updated_at" |
|
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 |
|
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 |
|
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" |
|
118 | + t.datetime "created_at" |
|
119 |
- t.datetime "updated_at" |
|
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 |
|
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" |
|
129 | + t.datetime "created_at" |
|
130 |
- t.datetime "updated_at" |
|
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 |
|
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" |
@@ -144,7 +144,7 | |||||
|
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= |
|
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 |
@@ -152,29 +152,29 | |||||
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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" |
@@ -182,24 +182,24 | |||||
|
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 |
|
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" |
|
189 | + t.datetime "created_at" |
|
190 |
- t.datetime "updated_at" |
|
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 |
|
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" |
|
198 | + t.datetime "created_at" |
|
199 |
- t.datetime "updated_at" |
|
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 |
|
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" |
@@ -222,7 +222,7 | |||||
|
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= |
|
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" |
@@ -230,7 +230,7 | |||||
|
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 |
|
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" |
@@ -238,15 +238,15 | |||||
|
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 |
|
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" |
|
245 | + t.datetime "created_at" |
|
246 |
- t.datetime "updated_at" |
|
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 |
|
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" |
@@ -254,20 +254,20 | |||||
|
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" |
|
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" |
|
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= |
|
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" |
@@ -279,15 +279,15 | |||||
|
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 |
|
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. |
|
284 | + t.timestamp "started_at" |
|
285 |
- t.datetime "created_at" |
|
285 | + t.datetime "created_at" |
|
286 |
- t.datetime "updated_at" |
|
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 |
|
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" |
@@ -299,10 +299,11 | |||||
|
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 |
You need to be logged in to leave comments.
Login now