Description:
* multiple ip login fix * fix when points is nil in stat page and user page
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r531:b75c92a947ff - - 6 files changed: 16 inserted, 16 deleted

@@ -16,7 +16,7
16
16
17 def update
17 def update
18 @config = GraderConfiguration.find(params[:id])
18 @config = GraderConfiguration.find(params[:id])
19 - User.clear_last_login if @config.key = 'multiple_ip_login' and @config.value == 'true' and params[:grader_configuration][:value] == 'false'
19 + User.clear_last_login if @config.key == GraderConfiguration::MULTIPLE_IP_LOGIN_KEY and @config.value == 'true' and params[:grader_configuration][:value] == 'false'
20 respond_to do |format|
20 respond_to do |format|
21 if @config.update_attributes(params[:grader_configuration])
21 if @config.update_attributes(params[:grader_configuration])
22 format.json { head :ok }
22 format.json { head :ok }
@@ -163,7 +163,7
163 @submissions.find_each do |sub|
163 @submissions.find_each do |sub|
164 d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60
164 d = (DateTime.now.in_time_zone - sub.submitted_at) / 24 / 60 / 60
165 @histogram[:data][d.to_i] += 1 if d < range
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 end
167 end
168 @histogram[:summary][:max] = [@histogram[:data].max,1].max
168 @histogram[:summary][:max] = [@histogram[:data].max,1].max
169
169
@@ -125,7 +125,7
125
125
126 @summary[:count] += 1
126 @summary[:count] += 1
127 next unless sub.problem
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 end
129 end
130
130
131 @histogram[:summary][:max] = [@histogram[:data].max,1].max
131 @histogram[:summary][:max] = [@histogram[:data].max,1].max
@@ -9,6 +9,7
9 TEST_REQUEST_EARLY_TIMEOUT_KEY = 'contest.test_request.early_timeout'
9 TEST_REQUEST_EARLY_TIMEOUT_KEY = 'contest.test_request.early_timeout'
10 MULTICONTESTS_KEY = 'system.multicontests'
10 MULTICONTESTS_KEY = 'system.multicontests'
11 CONTEST_TIME_LIMIT_KEY = 'contest.time_limit'
11 CONTEST_TIME_LIMIT_KEY = 'contest.time_limit'
12 + MULTIPLE_IP_LOGIN_KEY = 'right.multiple_ip_login'
12
13
13 cattr_accessor :config_cache
14 cattr_accessor :config_cache
14 cattr_accessor :task_grading_info_cache
15 cattr_accessor :task_grading_info_cache
@@ -58,7 +58,7
58 %td= s.language.pretty_name
58 %td= s.language.pretty_name
59 %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago)
59 %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago)
60 %td.fix-width= s.grader_comment
60 %td.fix-width= s.grader_comment
61 - %td= (s.points*100)/s.problem.full_score
61 + %td= ( s.try(:points) ? (s.points*100/s.problem.full_score) : '' )
62 - if session[:admin]
62 - if session[:admin]
63 %td= s.ip_address
63 %td= s.ip_address
64
64
@@ -15,7 +15,7
15
15
16 create_table "announcements", :force => true do |t|
16 create_table "announcements", :force => true do |t|
17 t.string "author"
17 t.string "author"
18 - t.text "body", :limit => 16777215
18 + t.text "body"
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
@@ -50,7 +50,7
50 end
50 end
51
51
52 create_table "descriptions", :force => true do |t|
52 create_table "descriptions", :force => true do |t|
53 - t.text "body", :limit => 16777215
53 + t.text "body"
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
@@ -62,7 +62,7
62 t.string "value"
62 t.string "value"
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 => 16777215
65 + t.text "description"
66 end
66 end
67
67
68 create_table "grader_processes", :force => true do |t|
68 create_table "grader_processes", :force => true do |t|
@@ -97,7 +97,7
97 t.integer "sender_id"
97 t.integer "sender_id"
98 t.integer "receiver_id"
98 t.integer "receiver_id"
99 t.integer "replying_message_id"
99 t.integer "replying_message_id"
100 - t.text "body", :limit => 16777215
100 + t.text "body"
101 t.boolean "replied"
101 t.boolean "replied"
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
@@ -142,7 +142,7
142
142
143 create_table "sessions", :force => true do |t|
143 create_table "sessions", :force => true do |t|
144 t.string "session_id"
144 t.string "session_id"
145 - t.text "data", :limit => 16777215
145 + t.text "data"
146 t.datetime "updated_at"
146 t.datetime "updated_at"
147 end
147 end
148
148
@@ -170,14 +170,14
170 t.integer "user_id"
170 t.integer "user_id"
171 t.integer "problem_id"
171 t.integer "problem_id"
172 t.integer "language_id"
172 t.integer "language_id"
173 - t.text "source", :limit => 16777215
173 + t.text "source"
174 t.binary "binary"
174 t.binary "binary"
175 t.datetime "submitted_at"
175 t.datetime "submitted_at"
176 t.datetime "compiled_at"
176 t.datetime "compiled_at"
177 - t.text "compiler_message", :limit => 16777215
177 + t.text "compiler_message"
178 t.datetime "graded_at"
178 t.datetime "graded_at"
179 t.integer "points"
179 t.integer "points"
180 - t.text "grader_comment", :limit => 16777215
180 + t.text "grader_comment"
181 t.integer "number"
181 t.integer "number"
182 t.string "source_filename"
182 t.string "source_filename"
183 t.float "max_runtime"
183 t.float "max_runtime"
@@ -198,8 +198,8
198
198
199 create_table "test_pairs", :force => true do |t|
199 create_table "test_pairs", :force => true do |t|
200 t.integer "problem_id"
200 t.integer "problem_id"
201 - t.text "input", :limit => 2147483647
201 + t.text "input", :limit => 16777215
202 - t.text "solution", :limit => 2147483647
202 + t.text "solution", :limit => 16777215
203 t.datetime "created_at", :null => false
203 t.datetime "created_at", :null => false
204 t.datetime "updated_at", :null => false
204 t.datetime "updated_at", :null => false
205 end
205 end
@@ -215,7 +215,7
215 t.datetime "updated_at", :null => false
215 t.datetime "updated_at", :null => false
216 t.datetime "submitted_at"
216 t.datetime "submitted_at"
217 t.datetime "compiled_at"
217 t.datetime "compiled_at"
218 - t.text "compiler_message", :limit => 16777215
218 + t.text "compiler_message"
219 t.datetime "graded_at"
219 t.datetime "graded_at"
220 t.string "grader_comment"
220 t.string "grader_comment"
221 t.datetime "created_at", :null => false
221 t.datetime "created_at", :null => false
@@ -246,7 +246,6
246 t.boolean "activated", :default => false
246 t.boolean "activated", :default => false
247 t.datetime "created_at"
247 t.datetime "created_at"
248 t.datetime "updated_at"
248 t.datetime "updated_at"
249 - t.string "section"
250 t.boolean "enabled", :default => true
249 t.boolean "enabled", :default => true
251 t.string "remark"
250 t.string "remark"
252 t.string "last_ip"
251 t.string "last_ip"
You need to be logged in to leave comments. Login now