Description:
* multiple ip login fix
* fix when points is nil in stat page and user page
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r531:b75c92a947ff - - 6 files changed: 30 inserted, 30 deleted
@@ -13,13 +13,13 | |||
|
13 | 13 | GraderConfiguration.reload |
|
14 | 14 | redirect_to :action => 'index' |
|
15 | 15 | end |
|
16 | 16 | |
|
17 | 17 | def update |
|
18 | 18 | @config = GraderConfiguration.find(params[:id]) |
|
19 |
- User.clear_last_login if @config.key = |
|
|
19 | + User.clear_last_login if @config.key == GraderConfiguration::MULTIPLE_IP_LOGIN_KEY and @config.value == 'true' and params[:grader_configuration][:value] == 'false' | |
|
20 | 20 | respond_to do |format| |
|
21 | 21 | if @config.update_attributes(params[:grader_configuration]) |
|
22 | 22 | format.json { head :ok } |
|
23 | 23 | else |
|
24 | 24 | format.json { respond_with_bip(@config) } |
|
25 | 25 | end |
@@ -160,13 +160,13 | |||
|
160 | 160 | range =65 |
|
161 | 161 | @histogram = { data: Array.new(range,0), summary: {} } |
|
162 | 162 | user = Hash.new(0) |
|
163 | 163 | @submissions.find_each do |sub| |
|
164 | 164 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
165 | 165 | @histogram[:data][d.to_i] += 1 if d < range |
|
166 | - user[sub.user_id] = [user[sub.user_id], (sub.try(:points) >= @problem.full_score) ? 1 : 0].max | |
|
166 | + user[sub.user_id] = [user[sub.user_id], ((sub.try(:points) || 0) >= @problem.full_score) ? 1 : 0].max | |
|
167 | 167 | end |
|
168 | 168 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
169 | 169 | |
|
170 | 170 | @summary = { attempt: user.count, solve: 0 } |
|
171 | 171 | user.each_value { |v| @summary[:solve] += 1 if v == 1 } |
|
172 | 172 | end |
@@ -122,13 +122,13 | |||
|
122 | 122 | #histogram |
|
123 | 123 | d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60 |
|
124 | 124 | @histogram[:data][d.to_i] += 1 if d < range |
|
125 | 125 | |
|
126 | 126 | @summary[:count] += 1 |
|
127 | 127 | next unless sub.problem |
|
128 | - problem[sub.problem] = [problem[sub.problem], (sub.points >= sub.problem.full_score) ? 1 : 0].max | |
|
128 | + problem[sub.problem] = [problem[sub.problem], ( (sub.try(:points) || 0) >= sub.problem.full_score) ? 1 : 0].max | |
|
129 | 129 | end |
|
130 | 130 | |
|
131 | 131 | @histogram[:summary][:max] = [@histogram[:data].max,1].max |
|
132 | 132 | @summary[:attempt] = problem.count |
|
133 | 133 | problem.each_value { |v| @summary[:solve] += 1 if v == 1 } |
|
134 | 134 | end |
@@ -6,12 +6,13 | |||
|
6 | 6 | class GraderConfiguration < ActiveRecord::Base |
|
7 | 7 | |
|
8 | 8 | SYSTEM_MODE_CONF_KEY = 'system.mode' |
|
9 | 9 | TEST_REQUEST_EARLY_TIMEOUT_KEY = 'contest.test_request.early_timeout' |
|
10 | 10 | MULTICONTESTS_KEY = 'system.multicontests' |
|
11 | 11 | CONTEST_TIME_LIMIT_KEY = 'contest.time_limit' |
|
12 | + MULTIPLE_IP_LOGIN_KEY = 'right.multiple_ip_login' | |
|
12 | 13 | |
|
13 | 14 | cattr_accessor :config_cache |
|
14 | 15 | cattr_accessor :task_grading_info_cache |
|
15 | 16 | cattr_accessor :contest_time_str |
|
16 | 17 | cattr_accessor :contest_time |
|
17 | 18 |
@@ -55,12 +55,12 | |||
|
55 | 55 | %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id |
|
56 | 56 | %td= link_to s.problem.name, controller: "problems", action: "stat", id: s.problem |
|
57 | 57 | %td= s.problem.full_name |
|
58 | 58 | %td= s.language.pretty_name |
|
59 | 59 | %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago) |
|
60 | 60 | %td.fix-width= s.grader_comment |
|
61 |
- %td= (s.points*100 |
|
|
61 | + %td= ( s.try(:points) ? (s.points*100/s.problem.full_score) : '' ) | |
|
62 | 62 | - if session[:admin] |
|
63 | 63 | %td= s.ip_address |
|
64 | 64 | |
|
65 | 65 | |
|
66 | 66 |
@@ -12,18 +12,18 | |||
|
12 | 12 | # It's strongly recommended to check this file into your version control system. |
|
13 | 13 | |
|
14 | 14 | ActiveRecord::Schema.define(:version => 20150827133841) do |
|
15 | 15 | |
|
16 | 16 | create_table "announcements", :force => true do |t| |
|
17 | 17 | t.string "author" |
|
18 |
- t.text "body" |
|
|
18 | + t.text "body" | |
|
19 | 19 | t.boolean "published" |
|
20 |
- t.datetime "created_at", |
|
|
21 |
- t.datetime "updated_at", |
|
|
22 |
- t.boolean "frontpage", |
|
|
23 |
- t.boolean "contest_only", |
|
|
20 | + t.datetime "created_at", :null => false | |
|
21 | + t.datetime "updated_at", :null => false | |
|
22 | + t.boolean "frontpage", :default => false | |
|
23 | + t.boolean "contest_only", :default => false | |
|
24 | 24 | t.string "title" |
|
25 | 25 | t.string "notes" |
|
26 | 26 | end |
|
27 | 27 | |
|
28 | 28 | create_table "contests", :force => true do |t| |
|
29 | 29 | t.string "title" |
@@ -47,25 +47,25 | |||
|
47 | 47 | t.string "name" |
|
48 | 48 | t.datetime "created_at", :null => false |
|
49 | 49 | t.datetime "updated_at", :null => false |
|
50 | 50 | end |
|
51 | 51 | |
|
52 | 52 | create_table "descriptions", :force => true do |t| |
|
53 |
- t.text "body" |
|
|
53 | + t.text "body" | |
|
54 | 54 | t.boolean "markdowned" |
|
55 |
- t.datetime "created_at", |
|
|
56 |
- t.datetime "updated_at", |
|
|
55 | + t.datetime "created_at", :null => false | |
|
56 | + t.datetime "updated_at", :null => false | |
|
57 | 57 | end |
|
58 | 58 | |
|
59 | 59 | create_table "grader_configurations", :force => true do |t| |
|
60 | 60 | t.string "key" |
|
61 | 61 | t.string "value_type" |
|
62 | 62 | t.string "value" |
|
63 |
- t.datetime "created_at", |
|
|
64 |
- t.datetime "updated_at", |
|
|
65 |
- t.text "description" |
|
|
63 | + t.datetime "created_at", :null => false | |
|
64 | + t.datetime "updated_at", :null => false | |
|
65 | + t.text "description" | |
|
66 | 66 | end |
|
67 | 67 | |
|
68 | 68 | create_table "grader_processes", :force => true do |t| |
|
69 | 69 | t.string "host", :limit => 20 |
|
70 | 70 | t.integer "pid" |
|
71 | 71 | t.string "mode" |
@@ -94,16 +94,16 | |||
|
94 | 94 | end |
|
95 | 95 | |
|
96 | 96 | create_table "messages", :force => true do |t| |
|
97 | 97 | t.integer "sender_id" |
|
98 | 98 | t.integer "receiver_id" |
|
99 | 99 | t.integer "replying_message_id" |
|
100 | - t.text "body", :limit => 16777215 | |
|
100 | + t.text "body" | |
|
101 | 101 | t.boolean "replied" |
|
102 |
- t.datetime "created_at", |
|
|
103 |
- t.datetime "updated_at", |
|
|
102 | + t.datetime "created_at", :null => false | |
|
103 | + t.datetime "updated_at", :null => false | |
|
104 | 104 | end |
|
105 | 105 | |
|
106 | 106 | create_table "problems", :force => true do |t| |
|
107 | 107 | t.string "name", :limit => 30 |
|
108 | 108 | t.string "full_name" |
|
109 | 109 | t.integer "full_score" |
@@ -139,13 +139,13 | |||
|
139 | 139 | end |
|
140 | 140 | |
|
141 | 141 | add_index "roles_users", ["user_id"], :name => "index_roles_users_on_user_id" |
|
142 | 142 | |
|
143 | 143 | create_table "sessions", :force => true do |t| |
|
144 | 144 | t.string "session_id" |
|
145 |
- t.text "data" |
|
|
145 | + t.text "data" | |
|
146 | 146 | t.datetime "updated_at" |
|
147 | 147 | end |
|
148 | 148 | |
|
149 | 149 | add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id" |
|
150 | 150 | add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at" |
|
151 | 151 | |
@@ -167,20 +167,20 | |||
|
167 | 167 | end |
|
168 | 168 | |
|
169 | 169 | create_table "submissions", :force => true do |t| |
|
170 | 170 | t.integer "user_id" |
|
171 | 171 | t.integer "problem_id" |
|
172 | 172 | t.integer "language_id" |
|
173 | - t.text "source", :limit => 16777215 | |
|
173 | + t.text "source" | |
|
174 | 174 | t.binary "binary" |
|
175 | 175 | t.datetime "submitted_at" |
|
176 | 176 | t.datetime "compiled_at" |
|
177 |
- t.text "compiler_message" |
|
|
177 | + t.text "compiler_message" | |
|
178 | 178 | t.datetime "graded_at" |
|
179 | 179 | t.integer "points" |
|
180 |
- t.text "grader_comment" |
|
|
180 | + t.text "grader_comment" | |
|
181 | 181 | t.integer "number" |
|
182 | 182 | t.string "source_filename" |
|
183 | 183 | t.float "max_runtime" |
|
184 | 184 | t.integer "peak_memory" |
|
185 | 185 | t.integer "effective_code_length" |
|
186 | 186 | t.string "ip_address" |
@@ -195,33 +195,33 | |||
|
195 | 195 | t.integer "status" |
|
196 | 196 | t.datetime "updated_at" |
|
197 | 197 | end |
|
198 | 198 | |
|
199 | 199 | create_table "test_pairs", :force => true do |t| |
|
200 | 200 | t.integer "problem_id" |
|
201 |
- t.text "input", :limit => |
|
|
202 |
- t.text "solution", :limit => |
|
|
203 |
- t.datetime "created_at", |
|
|
204 |
- t.datetime "updated_at", |
|
|
201 | + t.text "input", :limit => 16777215 | |
|
202 | + t.text "solution", :limit => 16777215 | |
|
203 | + t.datetime "created_at", :null => false | |
|
204 | + t.datetime "updated_at", :null => false | |
|
205 | 205 | end |
|
206 | 206 | |
|
207 | 207 | create_table "test_requests", :force => true do |t| |
|
208 | 208 | t.integer "user_id" |
|
209 | 209 | t.integer "problem_id" |
|
210 | 210 | t.integer "submission_id" |
|
211 | 211 | t.string "input_file_name" |
|
212 | 212 | t.string "output_file_name" |
|
213 | 213 | t.string "running_stat" |
|
214 | 214 | t.integer "status" |
|
215 |
- t.datetime "updated_at", |
|
|
215 | + t.datetime "updated_at", :null => false | |
|
216 | 216 | t.datetime "submitted_at" |
|
217 | 217 | t.datetime "compiled_at" |
|
218 |
- t.text "compiler_message" |
|
|
218 | + t.text "compiler_message" | |
|
219 | 219 | t.datetime "graded_at" |
|
220 | 220 | t.string "grader_comment" |
|
221 |
- t.datetime "created_at", |
|
|
221 | + t.datetime "created_at", :null => false | |
|
222 | 222 | t.float "running_time" |
|
223 | 223 | t.string "exit_status" |
|
224 | 224 | t.integer "memory_usage" |
|
225 | 225 | end |
|
226 | 226 | |
|
227 | 227 | add_index "test_requests", ["user_id", "problem_id"], :name => "index_test_requests_on_user_id_and_problem_id" |
@@ -243,13 +243,12 | |||
|
243 | 243 | t.string "email" |
|
244 | 244 | t.integer "site_id" |
|
245 | 245 | t.integer "country_id" |
|
246 | 246 | t.boolean "activated", :default => false |
|
247 | 247 | t.datetime "created_at" |
|
248 | 248 | t.datetime "updated_at" |
|
249 | - t.string "section" | |
|
250 | 249 | t.boolean "enabled", :default => true |
|
251 | 250 | t.string "remark" |
|
252 | 251 | t.string "last_ip" |
|
253 | 252 | end |
|
254 | 253 | |
|
255 | 254 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
You need to be logged in to leave comments.
Login now