Description:
modernize
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r574:6250748f34ac - - 1 file changed: 1 inserted, 1 deleted

@@ -218,49 +218,49
218 return false if site==nil
218 return false if site==nil
219 return site.finished?
219 return site.finished?
220 elsif GraderConfiguration.indv_contest_mode?
220 elsif GraderConfiguration.indv_contest_mode?
221 return false if self.contest_stat(true)==nil
221 return false if self.contest_stat(true)==nil
222 return contest_time_left == 0
222 return contest_time_left == 0
223 else
223 else
224 return false
224 return false
225 end
225 end
226 end
226 end
227
227
228 def contest_started?
228 def contest_started?
229 if GraderConfiguration.indv_contest_mode?
229 if GraderConfiguration.indv_contest_mode?
230 stat = self.contest_stat
230 stat = self.contest_stat
231 return ((stat != nil) and (stat.started_at != nil))
231 return ((stat != nil) and (stat.started_at != nil))
232 elsif GraderConfiguration.contest_mode?
232 elsif GraderConfiguration.contest_mode?
233 return true if site==nil
233 return true if site==nil
234 return site.started
234 return site.started
235 else
235 else
236 return true
236 return true
237 end
237 end
238 end
238 end
239
239
240 def update_start_time
240 def update_start_time
241 stat = self.contest_stat
241 stat = self.contest_stat
242 - if stat == nil or stat.started_at == nil
242 + if (stat.nil?) or (stat.started_at.nil?)
243 stat ||= UserContestStat.new(:user => self)
243 stat ||= UserContestStat.new(:user => self)
244 stat.started_at = Time.now.gmtime
244 stat.started_at = Time.now.gmtime
245 stat.save
245 stat.save
246 end
246 end
247 end
247 end
248
248
249 def problem_in_user_contests?(problem)
249 def problem_in_user_contests?(problem)
250 problem_contests = problem.contests.all
250 problem_contests = problem.contests.all
251
251
252 if problem_contests.length == 0 # this is public contest
252 if problem_contests.length == 0 # this is public contest
253 return true
253 return true
254 end
254 end
255
255
256 contests.each do |contest|
256 contests.each do |contest|
257 if problem_contests.find {|c| c.id == contest.id }
257 if problem_contests.find {|c| c.id == contest.id }
258 return true
258 return true
259 end
259 end
260 end
260 end
261 return false
261 return false
262 end
262 end
263
263
264 def available_problems_group_by_contests
264 def available_problems_group_by_contests
265 contest_problems = []
265 contest_problems = []
266 pin = {}
266 pin = {}
You need to be logged in to leave comments. Login now