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
@@ -105,24 +105,25 | |||||
|
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 |
@@ -6,30 +6,30 | |||||
|
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 | ||
@@ -41,37 +41,37 | |||||
|
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" |
@@ -98,28 +98,28 | |||||
|
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" |
@@ -144,25 +144,25 | |||||
|
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 |
@@ -172,112 +172,112 | |||||
|
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