Description:
fixed codejom stutus update to ignore disabled problems
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r246:180b30450ef3 - - 1 file changed: 2 inserted, 2 deleted
@@ -1,13 +1,13 | |||
|
1 |
- # -*- coding: u |
|
|
1 | + # -*- coding: utf-8 -*- | |
|
2 | 2 | require 'digest/sha1' |
|
3 | 3 | |
|
4 | 4 | class User < ActiveRecord::Base |
|
5 | 5 | |
|
6 | 6 | has_and_belongs_to_many :roles |
|
7 | 7 | |
|
8 | 8 | has_many :test_requests, :order => "submitted_at DESC" |
|
9 | 9 | |
|
10 | 10 | has_many :messages, |
|
11 | 11 | :class_name => "Message", |
|
12 | 12 | :foreign_key => "sender_id", |
|
13 | 13 | :order => 'created_at DESC' |
@@ -225,25 +225,25 | |||
|
225 | 225 | if Configuration.contest_mode? |
|
226 | 226 | return true if site==nil |
|
227 | 227 | return site.started |
|
228 | 228 | else |
|
229 | 229 | return true |
|
230 | 230 | end |
|
231 | 231 | end |
|
232 | 232 | |
|
233 | 233 | # For Code Jom |
|
234 | 234 | def update_codejom_status |
|
235 | 235 | status = codejom_status || CodejomStatus.new(:user => self) |
|
236 | 236 | problem_count = Problem.available_problem_count |
|
237 | - status.num_problems_passed = (self.submission_statuses.find_all {|s| s.passed}).length | |
|
237 | + status.num_problems_passed = (self.submission_statuses.find_all {|s| s.passed and s.problem.available }).length | |
|
238 | 238 | status.alive = (problem_count - (status.num_problems_passed)) <= CODEJOM_MAX_ALIVE_LEVEL |
|
239 | 239 | status.save |
|
240 | 240 | end |
|
241 | 241 | |
|
242 | 242 | def codejom_level |
|
243 | 243 | problem_count = Problem.available_problem_count |
|
244 | 244 | if codejom_status!=nil |
|
245 | 245 | return problem_count - codejom_status.num_problems_passed |
|
246 | 246 | else |
|
247 | 247 | return problem_count |
|
248 | 248 | end |
|
249 | 249 | end |
You need to be logged in to leave comments.
Login now